:root {
  color-scheme: dark;
  --spring: #93BD58;
  --gold: #d4af37;
  --night: #000;
  --surface: #100d08;
  --line: #493820;
  --text: #f5edd9;
  --muted: #bcb09a;
  --display: "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--night);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
button, select, input { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
a { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.shell { width: min(100% - 40px, 880px); margin-inline: auto; }
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}
.brand { display: grid; place-items: center; min-width: 44px; min-height: 44px; }
.brand img { display: block; }
.masthead-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: .85rem;
  text-decoration: none;
}
.masthead-link:hover { color: var(--gold); }

.gallery-hero { padding-block: clamp(24px, 7vw, 50px) 22px; }
.gallery-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.8rem, 7vw, 3.35rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .035em;
}
.gallery-hero p { margin: 9px 0 0; font-size: .88rem; line-height: 1.6; color: var(--muted); }

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  margin-bottom: 18px;
  border-block: 1px solid var(--line);
}
.search-control { min-width: 0; }
.sort-control { position: relative; }
.sort-control::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
}
.toolbar input, .toolbar select {
  width: 100%;
  min-height: 44px;
  padding: 8px 11px;
  border: 0;
  color: var(--text);
  background: var(--night);
}
.toolbar select { appearance: none; border-inline-start: 1px solid var(--line); padding-inline-end: 29px; }
.toolbar input::placeholder { color: var(--muted); opacity: 1; }
.toolbar :disabled { opacity: .68; }
.gallery-state {
  display: grid;
  place-items: center;
  min-height: 130px;
  padding: 18px;
  margin: 0;
  text-align: center;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.work-card {
  position: relative;
  min-width: 0;
  border-block: 1px solid var(--line);
}
.work-card:first-child { grid-column: 1 / -1; }
.card-link { display: block; text-decoration: none; }
.card-cover { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--night); }
.card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.work-card:first-child .card-cover { aspect-ratio: 1.08; }
.work-card:first-child .card-cover img { transform: scale(1.035); }
.work-card:first-child .card-cover::after {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  background:
    linear-gradient(var(--gold), var(--gold)) top left / 12px 1px,
    linear-gradient(var(--gold), var(--gold)) top left / 1px 12px,
    linear-gradient(var(--gold), var(--gold)) bottom right / 12px 1px,
    linear-gradient(var(--gold), var(--gold)) bottom right / 1px 12px;
  background-repeat: no-repeat;
  opacity: .5;
}
.card-info { padding: 13px 4px; }
.card-info h2 { margin: 0 0 7px; font: 600 1.1rem/1.35 var(--display); overflow-wrap: anywhere; }
.work-card:first-child .card-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 12px;
}
.work-card:first-child .card-info h2 { grid-column: 1 / -1; font-size: clamp(1.55rem, 6vw, 2.35rem); }
.card-enter { display: none; }
.work-card:first-child .card-enter {
  display: block;
  color: var(--gold);
  font-size: .84rem;
}
.card-meta {
  margin: 0;
  display: flex;
  gap: 4px 8px;
  flex-wrap: wrap;
  justify-content: space-between;
  color: var(--muted);
  font-size: .74rem;
  overflow-wrap: anywhere;
}
.card-likes { white-space: nowrap; }
.work-card:first-child .card-meta { justify-content: start; }
.favorite {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: #000d;
  font-size: 1.24rem;
}
.favorite[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 17px 22px;
  margin-top: 30px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.5;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 650px) {
  .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .work-card:first-child .card-link { display: grid; grid-template-columns: 3fr 2fr; align-items: center; }
  .work-card:first-child .card-cover { aspect-ratio: 1.15; }
  .work-card:first-child .card-info { padding-inline: clamp(20px, 4vw, 42px); }
}

.play-shell { max-width: 680px; }
#play-page { padding-bottom: 32px; }
.play-title {
  margin: 14px 0 5px;
  font: 600 clamp(1.55rem, 6vw, 2.55rem)/1.2 var(--display);
  overflow-wrap: anywhere;
}
.camera-hint { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.work-frame {
  display: block;
  width: 100%;
  height: clamp(390px, 65svh, 580px);
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--night);
}
.play-actions { display: flex; gap: 8px; margin-top: 14px; }
.button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  font-weight: 650;
}
.button:disabled { opacity: .62; }
.button-primary {
  flex: 1;
  border-color: var(--spring);
  background: var(--spring);
  color: var(--night);
}
.work-credit {
  margin-top: 17px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.6;
}
.work-credit p { margin: 4px 0 0; }
.work-credit a { color: var(--gold); text-underline-offset: 3px; }
.action-status { color: var(--muted); font-size: .82rem; margin: 7px 0; }
.action-status:empty { margin: 0; }
.share-preview {
  display: block;
  width: min(100%, 350px);
  height: auto;
  margin: 12px auto;
}

.play-section { margin-top: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.play-section h2, .share-dialog h2 { margin: 0; font-size: 1.13rem; }
.prompt-excerpt {
  margin: 10px 0;
  padding: 7px 12px;
  border-inline-start: 2px solid var(--gold);
  color: var(--muted);
  font-family: var(--display);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.prompt-source { color: var(--gold); text-underline-offset: 3px; }
.prompt {
  margin: 7px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: .9rem;
  line-height: 1.65;
}
.prompt code { font: inherit; }
.improvement-list { color: var(--muted); padding-inline-start: 21px; font-size: .93rem; line-height: 1.7; }
.improvement-list li::marker { color: var(--gold); }

.share-dialog {
  width: min(100% - 32px, 430px);
  max-height: 90svh;
  padding: 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.share-dialog::backdrop { background: #000c; }
.share-dialog img { display: block; width: 100%; height: auto; margin: 10px auto 0; }

.exhibit-label { margin: 0; color: #cbb26e; font-size: .72rem; font-weight: 550; letter-spacing: .13em; }
.gallery-hero .exhibit-label { margin: 0 0 10px; color: #cbb26e; font-size: .72rem; }
.card-info .card-number { grid-column: 1 / -1; margin-bottom: 6px; }
.play-number { margin-top: 12px; }
.brand img { width: 92px; height: auto; }
