@import url("/fonts/songti.css");

:root {
  color-scheme: light;
  --desk: #edf4f2;
  --paper: #fbfdfc;
  --ink: #000;
  --accent: #17634f;
  --accent-dark: #124c3d;
  --line: #a8bdb7;
  --soft-line: #cbdcd7;
  --select: #d6f1e8;
  --selection-line: #32816d;
  --wash: #f0f8f5;
  --serif: "Survey Songti", "Songti SC", "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  background: var(--desk);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--selection-line); outline-offset: 3px; }
h1:focus, legend:focus { outline: none; }
a { color: var(--ink); text-underline-offset: .19em; }
p { margin: 0 0 .9rem; line-height: 1.65; }
h1, h2 { margin: 0 0 1.3rem; font-family: var(--serif); line-height: 1.14; font-weight: 700; }
h1 { font-size: clamp(2.25rem, 4.4vw, 4rem); }
h2 { font-size: 1.65rem; }
.shell {
  width: min(1200px, calc(100% - 64px));
  margin: clamp(20px, 6vh, 72px) auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 15px 48px #29443d12, 0 1px 0 white inset;
}
.title-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#f5fbf9, #e7f4ef);
  color: var(--ink);
  font-weight: 650;
}
.window-icon {
  width: 16px;
  height: 15px;
  border: 1px solid var(--accent);
  box-shadow: 1px 1px 0 #fff;
  background: linear-gradient(to bottom, var(--selection-line) 0 27%, #eef9f5 27%);
}
.exit { margin-left: auto; border: 0; padding: 5px 0 5px 10px; background: transparent; color: var(--ink); font-size: .9rem; font-weight: 500; }
.exit:hover { text-decoration: underline; }
.welcome {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  min-height: min(650px, 76dvh);
}
.welcome-copy { padding: clamp(35px, 5.4vw, 80px) clamp(26px, 5vw, 72px); }
.welcome-copy h1 { font-size: clamp(2.5rem, 4.4vw, 4.5rem); letter-spacing: .015em; margin-bottom: 26px; color: var(--ink); }
.welcome-copy p { max-width: 33em; color: var(--ink); }
.consent { margin-top: 27px; padding-top: 20px; border-top: 1px solid var(--soft-line); }
.consent p { color: var(--ink); }
.cover {
  min-width: 0;
  display: grid;
  align-items: stretch;
  padding: clamp(28px, 4vw, 58px) clamp(28px, 4vw, 58px) clamp(28px, 4vw, 58px) 0;
}
.cover-frame {
  position: relative;
  isolation: isolate;
  padding: 10px;
  border: 1px solid var(--line);
  background: #eef5f3;
  box-shadow: 1px 1px 0 white inset;
}
.cover-frame::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 16px -15px -15px 16px;
  border: 1px solid var(--soft-line);
  background: #e7f1ee;
}
.cover-frame img { position: absolute; inset: 10px; height: calc(100% - 20px); width: calc(100% - 20px); object-fit: cover; object-position: 54% 50%; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.primary, .quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 8px 17px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  background: var(--wash);
  text-decoration: none;
  font-weight: 650;
}
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.quiet:hover { background: var(--select); }
.primary:disabled, .quiet:disabled { color: var(--ink); background: #e6efec; border-color: var(--line); }
.standard { max-width: 850px; padding: clamp(27px, 6vw, 68px); margin: 0 auto; }
.standard h1 { letter-spacing: .01em; }
.standard .actions { margin-top: 21px; }
.standard fieldset + fieldset { margin-top: 24px; }
.standard legend { font-weight: 650; margin-bottom: 9px; line-height: 1.5; }
.standard p { color: var(--ink); }
.instructions, .finished { min-height: 400px; }
fieldset, figure { min-width: 0; border: 0; padding: 0; margin: 0; }
legend { padding: 0; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.option-card, .scale-card, .choice {
  position: relative;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.option-card { display: flex; align-items: center; min-height: 45px; gap: 9px; padding: 8px 12px; }
.option-card input, .scale-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option-card:has(input:focus-visible), .scale-card:has(input:focus-visible) { outline: 3px solid var(--selection-line); outline-offset: 2px; z-index: 1; }
.radio-mark { flex: 0 0 15px; width: 15px; height: 15px; border-radius: 50%; border: 1px solid #638077; background: white; }
.option-card:has(input:checked) .radio-mark { border: 4px solid var(--accent); }
.option-card:has(input:checked), .scale-card:has(input:checked), .choice[aria-pressed="true"] { color: var(--ink); border-color: var(--selection-line); background: var(--select); }
.option-card:hover, .scale-card:hover, .choice:hover { border-color: var(--selection-line); }
.optional { color: var(--ink); font-weight: 400; }
.feedback, .choice-feedback { color: var(--ink); font-size: .9rem; margin: 0; }
.feedback:empty, .choice-feedback:empty { display: none; }
.standard .feedback, .choice-feedback { margin-top: 6px; }
.shell.experiment-shell { width: 100%; margin: 0; border: 0; box-shadow: none; }
.experiment-shell > .title-bar { display: none; }
.experiment {
  --picture-edge: clamp(9px, 2vw, 30px);
  position: relative;
  isolation: isolate;
  height: 100dvh;
  overflow: hidden;
  background: #aaa9a5;
}
.scene-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
}
.experiment:is([data-stage="viewing"], [data-stage="rating"]) .scene-backdrop { visibility: visible; }
.scene-backdrop img {
  position: absolute;
  inset: -32px;
  width: calc(100% + 64px);
  height: calc(100% + 64px);
  object-fit: cover;
  filter: blur(27px) saturate(.69);
}
.scene-backdrop::after { position: absolute; content: ""; inset: 0; background: #f5f8f77a; }
.experiment[data-stage="rating"] .scene-backdrop::after { background: #f5f9f7a8; }
.fixation {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
}
.experiment[data-stage="fixation"] .fixation { display: grid; }
.fixation span {
  width: 33px;
  height: 33px;
  border: 1px solid #4c4c46;
  border-radius: 50%;
  background:
    linear-gradient(#373832, #373832) center / 13px 1px no-repeat,
    linear-gradient(#373832, #373832) center / 1px 13px no-repeat;
}
.image-error { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; text-align: center; }
.trial-form {
  --answer-top: max(12px, env(safe-area-inset-top));
  --answer-edge: clamp(14px, 2.7vw, 50px);
  --head-height: 38px;
  position: relative;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(400px, 1fr);
  grid-template-rows: var(--head-height) minmax(0, 1fr);
  gap: 12px clamp(18px, 4vw, 65px);
  padding: var(--answer-top) var(--answer-edge) max(12px, env(safe-area-inset-bottom));
}
.trial-top {
  position: relative;
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 4px;
}
.trial-top h1 { margin: 0; font-family: inherit; font-size: .94rem; font-weight: 600; }
.trial-top h1 span { font-weight: 400; }
.trial-top .exit { min-height: 34px; padding: 2px 0 2px 12px; }
progress {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 2px;
  border: 0;
  appearance: none;
  background: #285f5030;
  color: var(--accent);
}
progress::-webkit-progress-bar { background: #285f5030; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.stimulus {
  position: absolute;
  inset: var(--picture-edge);
}
.stimulus img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.experiment[data-stage="rating"] .stimulus {
  inset: calc(var(--answer-top) + var(--head-height) + 12px) 48% var(--answer-edge) var(--answer-edge);
  transition: inset 280ms cubic-bezier(.22,.7,.22,1);
}
.ratings {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  position: relative;
  display: grid;
  gap: 12px;
  max-height: 100%;
  overflow-y: auto;
  padding: clamp(15px, 2.3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fbfdfcf5;
  box-shadow: 4px 4px 0 #244f451a;
  animation: show-ratings 300ms cubic-bezier(.2,.76,.24,1) both;
}
@keyframes show-ratings { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.ratings legend { margin-bottom: 5px; font-size: .95rem; line-height: 1.28; font-weight: 600; }
.scale-note { margin: -2px 0 6px; color: var(--ink); font-size: .875rem; line-height: 1.36; }
.emotion-grid, .scale-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.choice { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 2px; padding: 4px 9px; text-align: left; font-size: .91rem; }
.standard .choice { min-height: 45px; }
.emotion-grid .choice:last-child { grid-column: span 2; }
.emotion-grid .choice-label, .scale-card span { word-break: keep-all; }
.rank { display: grid; flex: 0 0 1.1em; place-items: center; height: 1.18em; font-size: .8rem; font-weight: 700; }
.choice[aria-pressed="true"] .rank { color: #fff; background: var(--accent); border-radius: 1px; }
.scale-card {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 2px 3px;
  text-align: center;
  font-size: .83rem;
  line-height: 1.16;
}
.ratings .scale-row { gap: 0; border-block: 1px solid var(--line); background: var(--wash); }
.ratings .scale-card { font-weight: 500; border: 0; border-radius: 0; background: transparent; }
.ratings .scale-card + .scale-card { border-left: 1px solid var(--soft-line); }
.ratings .scale-card:hover { background: #e5f4ee; }
.ratings .scale-card:has(input:checked) { background: var(--select); box-shadow: inset 0 -2px var(--selection-line); }
.emotion-grid .choice { font-weight: 500; border-radius: 1px; border-color: var(--soft-line); background: #fff; }
.emotion-grid .choice[aria-pressed="true"] { border-color: var(--selection-line); background: var(--select); }
.trial-footer { display: flex; align-items: center; justify-content: end; min-height: 44px; gap: 6px; }
.trial-footer .feedback { margin-right: auto; line-height: 1.18; }
.trial-footer button { flex: none; }
@media (prefers-reduced-motion: reduce) {
  .experiment[data-stage="rating"] .stimulus { transition: none; }
  .ratings { animation: none; }
}
@media (max-width: 760px) {
  .trial-form {
    --answer-top: max(4px, env(safe-area-inset-top));
    --answer-edge: 8px;
    --head-height: 32px;
    --answer-picture: clamp(80px, calc(100dvh - 450px), 29dvh);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--head-height) var(--answer-picture) minmax(0, 1fr);
    gap: 5px;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }
  .trial-top { grid-column: 1; padding-bottom: 3px; }
  .trial-top .exit { min-height: 28px; }
  .experiment[data-stage="rating"] .stimulus {
    inset: calc(var(--answer-top) + var(--head-height) + 5px) var(--answer-edge)
      calc(100% - var(--answer-top) - var(--head-height) - 5px - var(--answer-picture));
  }
  .ratings {
    grid-column: 1;
    grid-row: 3;
    align-self: start;
    gap: 6px;
    padding: 8px;
    box-shadow: none;
  }
  .ratings legend { margin-bottom: 4px; font-size: .87rem; }
  .emotion-grid .choice { padding: 3px 4px; min-height: 40px; font-size: .88rem; }
  .scale-card { min-height: 44px; font-size: .8rem; }
  .trial-footer .primary { min-height: 42px; }
}
@media (max-width: 760px) and (max-height: 680px) {
  .trial-form { --answer-picture: clamp(62px, calc(100dvh - 492px), 150px); }
  .ratings { gap: 4px; padding: 6px; }
  .ratings legend { margin-bottom: 3px; font-size: .82rem; }
  .emotion-grid .choice { min-height: 34px; }
  .scale-card { min-height: 39px; font-size: .75rem; }
  .trial-footer, .trial-footer .primary { min-height: 39px; }
}
@media (max-height: 510px) and (orientation: landscape) {
  .trial-form {
    --answer-top: 4px;
    --answer-edge: 9px;
    --head-height: 28px;
    grid-template-columns: minmax(0, .75fr) minmax(0, 1fr);
    grid-template-rows: var(--head-height) minmax(0, 1fr);
    gap: 5px 12px;
  }
  .trial-top { grid-column: 1 / -1; }
  .experiment[data-stage="rating"] .stimulus {
    inset: calc(var(--answer-top) + var(--head-height) + 5px) 58% 10px var(--answer-edge);
  }
  .ratings { grid-column: 2; grid-row: 2; gap: 5px; padding: 7px; }
  .ratings legend { margin-bottom: 3px; font-size: .83rem; }
  .scale-card { min-height: 34px; font-size: .75rem; }
}

dialog { max-width: min(430px, 92vw); padding: 24px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #182b2666; }
.research { max-width: 1100px; }
.research h2 { margin: 1.4em 0 .6em; }
.research input[type=password] { min-height: 45px; border: 1px solid var(--line); padding: 8px; min-width: 0; width: min(300px, 100%); }
.research label { display: block; margin-bottom: 6px; }
.scroll-table { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--soft-line); vertical-align: middle; }
th { color: var(--ink); font-weight: 700; }
.catalog-thumb { width: 102px; height: 72px; object-fit: contain; display: block; background: var(--desk); }
@media (max-width: 760px) {
  .shell { width: calc(100% - 20px); margin: 10px auto; }
  .title-bar { min-height: 40px; padding: 4px 12px; }
  .welcome { grid-template-columns: 1fr; }
  .welcome-copy { padding: 24px 20px 22px; }
  .welcome-copy h1 { font-size: clamp(2.8rem, 8.3vw, 3.7rem); margin-bottom: 16px; }
  .welcome-copy p { margin-bottom: .7rem; }
  .consent { margin-top: 15px; padding-top: 13px; }
  .cover { grid-row: 1; min-height: clamp(115px, 24vw, 165px); padding: 14px 21px 0 14px; }
  .cover-frame::before { inset: 7px -7px -7px 7px; }
  .cover-frame img { inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); }
  .standard { padding: 23px 15px; }
}
@media (max-width: 360px) {
  .option-card, .standard .choice { font-size: .92rem; }
}
#credits { padding-left: 1.3em; }
#credits li { margin: .65em 0; line-height: 1.6; }
.research details { margin: 1rem 0; }
.research summary { cursor: pointer; min-height: 36px; }
