:root {
  --bg: #f3f0e8;
  --paper: #e9e2d5;
  --ink: #292720;
  --muted: #797266;
  --line: rgba(41, 39, 32, .2);
  --accent: #75523b;
  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 75% 42%, rgba(117, 82, 59, .055), transparent 30%),
    var(--bg);
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 300;
  line-height: 1.8;
}

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

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

.site-header,
footer {
  width: min(calc(100% - 48px), var(--max));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  height: 88px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: "Noto Serif TC", serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .14em;
}

.edition,
.eyebrow,
.card-footer,
.hint,
footer {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .17em;
}

.site-tabs {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 30px;
}

.site-tab {
  position: relative;
  padding: 2px 0 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font: 400 .78rem/1 "Noto Sans TC", sans-serif;
  letter-spacing: .1em;
  cursor: pointer;
}

.site-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .25s ease;
}

.site-tab:hover,
.site-tab.is-active { color: var(--ink); }
.site-tab.is-active::after { transform: scaleX(1); }
.site-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }

.site-view[hidden] { display: none; }

.generator {
  width: min(calc(100% - 48px), var(--max));
  min-height: calc(100vh - 176px);
  margin: 0 auto;
  padding: clamp(54px, 7vw, 92px) 0 clamp(72px, 9vw, 120px);
}

.intro { margin: 0 auto 46px; text-align: center; }

.eyebrow { margin: 0 0 30px; font-weight: 500; }

h1 {
  margin: 0 0 24px;
  font-family: "Noto Serif TC", serif;
  font-size: clamp(2.8rem, 6vw, 5.3rem);
  font-weight: 500;
  letter-spacing: -.05em;
  line-height: 1.22;
}

.description {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: .04em;
}

.quote-stage { width: min(100%, 430px); margin: 0 auto; }

.quote-card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid rgba(117, 82, 59, .18);
  background: #5d554a;
  box-shadow: 0 28px 70px rgba(54, 45, 34, .08);
}

.quote-copy::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -130px;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
}

.quote-visual {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  background: #d8d0c2;
}

.quote-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(24, 22, 18, .76) 0%, rgba(24, 22, 18, .58) 52%, rgba(24, 22, 18, .12) 100%),
    linear-gradient(0deg, rgba(24, 22, 18, .4) 0%, transparent 48%);
}

.quote-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: opacity .35s ease, transform .8s ease;
}

.quote-card:hover .quote-visual img { transform: scale(1.018); }

.quote-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  height: 100%;
  padding: 76px clamp(26px, 6vw, 40px) 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: #f7f3ea;
}

.card-mark {
  position: absolute;
  top: 18px;
  left: 28px;
  color: rgba(255, 255, 255, .34);
  font-family: Georgia, serif;
  font-size: 5.5rem;
  line-height: 1;
}

.quote {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Noto Serif TC", serif;
  max-width: 520px;
  font-size: clamp(.78rem, 3.6vw, 1.375rem);
  font-weight: 500;
  letter-spacing: .02em;
  line-height: 1.75;
}

.quote span {
  display: block;
  white-space: nowrap;
}

.quote.is-long {
  font-size: clamp(.78rem, 3.6vw, 1.25rem);
}

.quote.is-changing { animation: reveal .48s ease both; }

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

.card-footer {
  position: absolute;
  z-index: 1;
  right: clamp(26px, 6vw, 40px);
  bottom: 34px;
  left: clamp(26px, 6vw, 40px);
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, .68);
}

.generate-button {
  width: 100%;
  margin-top: 18px;
  padding: 17px 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--bg);
  border: 1px solid var(--ink);
  background: var(--ink);
  font: 400 .88rem/1.2 "Noto Sans TC", sans-serif;
  letter-spacing: .12em;
  cursor: pointer;
  transition: color .25s ease, background .25s ease;
}

.generate-button:hover { color: var(--ink); background: transparent; }
.generate-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.button-icon { font-size: 1.1rem; transition: transform .4s ease; }
.generate-button:hover .button-icon { transform: rotate(120deg); }
.hint { margin: 12px 0 0; text-align: center; letter-spacing: .08em; }

.quiz-section {
  width: min(calc(100% - 48px), var(--max));
  min-height: calc(100vh - 176px);
  margin: 0 auto;
  padding: clamp(48px, 6vw, 78px) 0 clamp(72px, 8vw, 110px);
}

.quiz-shell { min-height: 590px; }
.quiz-topline {
  min-height: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.quiz-topline .eyebrow { margin: 0; }
.quiz-back {
  padding: 0;
  color: var(--muted);
  border: 0;
  background: transparent;
  font: 400 .75rem/1.4 "Noto Sans TC", sans-serif;
  letter-spacing: .08em;
  cursor: pointer;
}
.quiz-back:hover { color: var(--ink); }

.quiz-progress {
  height: 2px;
  margin: 20px 0 clamp(34px, 5vw, 56px);
  overflow: hidden;
  background: rgba(41, 39, 32, .12);
}
.quiz-progress span {
  display: block;
  width: 20%;
  height: 100%;
  background: var(--accent);
  transition: width .35s ease;
}
.quiz-heading {
  margin-bottom: clamp(30px, 4vw, 45px);
  display: flex;
  justify-content: space-between;
  gap: 30px;
}
.quiz-scene {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: .88rem;
  letter-spacing: .04em;
}
.quiz-title,
.quiz-result h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.3vw, 3.1rem);
  letter-spacing: -.035em;
}
.quiz-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .12em;
}
.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.answer-card {
  position: relative;
  min-height: 152px;
  padding: 34px 34px 30px 62px;
  display: flex;
  align-items: center;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 255, 255, .17);
  font: 300 clamp(.93rem, 1.5vw, 1.08rem)/1.65 "Noto Sans TC", sans-serif;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.answer-card:hover {
  border-color: var(--accent);
  background: rgba(117, 82, 59, .07);
  transform: translateY(-2px);
}
.answer-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.answer-letter {
  position: absolute;
  top: 16px;
  left: 18px;
  color: var(--muted);
  font: 400 .75rem/1 "Noto Sans TC", sans-serif;
}

.quiz-result {
  width: min(100%, 760px);
  margin: clamp(42px, 7vw, 80px) auto 0;
  text-align: center;
  animation: reveal .5s ease both;
}
.quiz-result .eyebrow { margin: 0 0 25px; }
.result-kicker { margin: 0 0 8px; color: var(--muted); }
.result-description {
  max-width: 520px;
  margin: 22px auto 36px;
  color: var(--muted);
  font-family: "Noto Serif TC", serif;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}
.flavor-note {
  padding: 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.flavor-note span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .72rem;
  letter-spacing: .12em;
}
.flavor-note strong {
  font-weight: 400;
  letter-spacing: .04em;
}
.restart-button {
  min-width: 190px;
  margin-top: 34px;
  padding: 14px 20px;
  display: inline-flex;
  justify-content: space-between;
  gap: 28px;
  color: var(--bg);
  border: 1px solid var(--ink);
  background: var(--ink);
  font: 400 .82rem/1.2 "Noto Sans TC", sans-serif;
  letter-spacing: .1em;
  cursor: pointer;
}
.restart-button:hover { color: var(--ink); background: transparent; }

footer {
  min-height: 88px;
  border-top: 1px solid var(--line);
  letter-spacing: .08em;
}

@media (max-width: 760px) {
  .site-header, footer, .generator, .quiz-section { width: min(calc(100% - 32px), var(--max)); }
  .site-header { height: 74px; }
  .brand { font-size: .95rem; letter-spacing: .08em; }
  .site-tabs { gap: 16px; }
  .site-tab { font-size: .69rem; letter-spacing: .04em; }
  .generator { min-height: auto; padding: 48px 0 72px; }
  .intro { padding-top: 0; }
  h1 { margin-bottom: 26px; }
  .intro { margin-bottom: 36px; }
  .quote-copy { padding: 68px 28px 72px; }
  .quote-visual::after {
    background:
      linear-gradient(90deg, rgba(24, 22, 18, .7), rgba(24, 22, 18, .3)),
      linear-gradient(0deg, rgba(24, 22, 18, .52), transparent 65%);
  }
  .card-footer { right: 28px; left: 28px; }
  .quiz-section { padding: 38px 0 72px; }
  .quiz-progress { margin: 14px 0 32px; }
  .quiz-heading { margin-bottom: 25px; gap: 14px; }
  .quiz-title { font-size: 1.65rem; }
  .answer-grid { grid-template-columns: 1fr; gap: 12px; }
  .answer-card { min-height: 105px; padding: 28px 24px 22px 48px; }
  .answer-letter { top: 14px; left: 15px; }
  .quiz-result { margin-top: 38px; }
  footer { padding: 24px 0; align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
