:root {
  color-scheme: dark;
  --paper: #c8c0ae;
  --paper-bright: #e7dfc8;
  --ink: #181817;
  --ink-soft: #2b2a27;
  --copper: #55746b;
  --gold: #c3a250;
  --rust: #a64132;
  --rust-dark: #6f211d;
  --moss: #6f8d63;
  --time: #5f8f96;
  --bone: #f1e8ce;
  --line: rgba(231, 223, 200, .24);
  --text-scale: 1;
  --ease: cubic-bezier(.22, .8, .22, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 1180px;
  min-height: 720px;
  margin: 0;
  background: var(--ink);
  color: var(--paper-bright);
  font-family: "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  font-size: calc(15px * var(--text-scale));
  letter-spacing: 0;
  overflow: hidden;
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

#app {
  width: 100vw;
  height: 100vh;
  min-height: 720px;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  overflow: hidden;
}

.screen::before {
  position: absolute;
  inset: 0;
  z-index: -3;
  content: "";
  background: url("./assets/clock-hall.png") center center / cover no-repeat;
}

.screen::after {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  background: rgba(17, 17, 16, .25);
  pointer-events: none;
}

.title-screen {
  display: grid;
  place-items: center;
}

.title-copy {
  position: relative;
  width: min(560px, 42vw);
  margin-top: -4vh;
  text-align: center;
}

.title-copy::before {
  position: absolute;
  top: -48px;
  left: 50%;
  width: 1px;
  height: 34px;
  content: "";
  background: var(--gold);
}

.trial-mark,
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.game-title {
  margin: 0;
  color: var(--bone);
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 3px 0 var(--ink), 0 0 24px rgba(195, 162, 80, .28);
}

.match-code {
  display: inline-block;
  margin: 22px 0 34px;
  padding: 7px 12px;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  color: var(--paper-bright);
  background: rgba(24, 24, 23, .76);
  font-family: "SimSun", "Noto Serif SC", serif;
}

.primary-command,
.secondary-command,
.action-option,
.claim-option,
.reaction-option,
.declaration-option,
.ending-option {
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 180ms var(--ease), background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.primary-command {
  min-width: 190px;
  min-height: 48px;
  padding: 12px 24px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

.primary-command:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #d4b45c;
}

.primary-command:disabled,
.secondary-command:disabled,
.ending-option:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.secondary-command {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid rgba(231, 223, 200, .4);
  background: rgba(24, 24, 23, .72);
}

.secondary-command:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(231, 223, 200, .28);
  border-radius: 50%;
  background: rgba(24, 24, 23, .78);
  color: var(--paper-bright);
  cursor: pointer;
}

.settings-trigger {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
}

.game-screen {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 205px;
  background: rgba(18, 18, 17, .3);
}

.topbar {
  display: grid;
  grid-template-columns: 22% 56% 22%;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: rgba(21, 21, 20, .9);
}

.brand-block,
.round-block,
.status-strip {
  display: flex;
  min-width: 0;
  align-items: center;
}

.brand-block {
  padding-left: 20px;
  gap: 10px;
  font-family: "SimSun", "Noto Serif SC", serif;
  font-weight: 800;
}

.brand-number {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--gold);
  color: var(--gold);
}

.round-block {
  justify-content: center;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  text-align: center;
}

.round-block strong {
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: 1.05rem;
}

.status-strip {
  padding: 0 58px 0 14px;
  justify-content: flex-end;
  gap: 14px;
}

.status-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: .78rem;
}

.status-glyph {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid currentColor;
  font-size: .7rem;
}

.status-danger {
  color: #d67262;
}

.status-clue {
  color: var(--bone);
}

.status-fire {
  color: #f1dfb5;
}

.workspace {
  display: grid;
  min-height: 0;
  grid-template-columns: 22% 56% 22%;
}

.team-rail,
.inspector {
  min-width: 0;
  overflow: auto;
  overflow-x: hidden;
  background: rgba(24, 24, 23, .88);
  scrollbar-width: thin;
}

.team-rail {
  border-right: 1px solid var(--line);
}

.inspector {
  border-left: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  min-height: 42px;
  padding: 10px 14px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: rgba(231, 223, 200, .72);
  font-size: .75rem;
  font-weight: 700;
}

.mode-hint {
  color: var(--gold);
}

.team-list {
  display: flex;
  flex-direction: column;
}

.team-member {
  position: relative;
  display: grid;
  min-height: 112px;
  padding: 10px 12px;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms var(--ease);
}

.team-member:hover {
  background: rgba(231, 223, 200, .06);
}

.team-member.selected {
  background: rgba(195, 162, 80, .12);
  box-shadow: inset 3px 0 var(--gold);
}

.team-member.trust-high {
  transform: translateX(5px);
}

.team-member.trust-zero {
  transform: translateX(-5px);
  background: rgba(142, 48, 45, .12);
}

.team-member.marked::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid var(--rust);
  transform: rotate(45deg);
}

.portrait {
  width: 78px;
  height: 91px;
  border: 1px solid rgba(231, 223, 200, .28);
  background-image: url("./assets/team-sheet.png");
  background-repeat: no-repeat;
  background-size: 200% 200%;
  filter: saturate(.75) contrast(1.05);
}

.portrait-tang { background-position: 0 0; }
.portrait-yu { background-position: 100% 0; }
.portrait-qiao { background-position: 0 100%; }
.portrait-lumi { background-position: 100% 100%; }

.member-copy {
  min-width: 0;
}

.member-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.member-name {
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: 1rem;
  font-weight: 800;
}

.member-role {
  margin-top: 3px;
  color: rgba(231, 223, 200, .65);
  font-size: .72rem;
}

.member-role.erased {
  color: rgba(231, 223, 200, .42);
  text-decoration: line-through 3px var(--ink);
}

.member-state {
  display: flex;
  margin-top: 10px;
  gap: 8px;
  align-items: center;
  font-size: .7rem;
}

.trust-track {
  display: flex;
  gap: 3px;
}

.trust-knot {
  width: 12px;
  height: 5px;
  border: 1px solid rgba(231, 223, 200, .3);
  transform: skewX(-16deg);
}

.trust-knot.on {
  border-color: var(--moss);
  background: var(--moss);
}

.trust-zero .trust-track {
  transform: rotate(-2deg);
}

.member-object {
  margin-top: 8px;
  color: rgba(231, 223, 200, .58);
  font-size: .68rem;
}

.member-specialty {
  display: block;
  margin-top: 7px;
  color: var(--gold);
  font-size: .68rem;
}

.member-object {
  display: block;
  margin-top: 3px;
}

.stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.stage::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: url("./assets/clock-hall.png") center 43% / cover no-repeat;
  filter: saturate(.82) contrast(1.05) brightness(.82);
  transform: scale(1.01);
}

.stage.instability-high::before {
  filter: saturate(.75) contrast(1.12) brightness(.7);
}

.stage-content {
  position: relative;
  display: flex;
  height: 100%;
  padding: 28px 34px 24px;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.stage-copy {
  max-width: 620px;
  padding: 12px 18px;
  background: rgba(24, 24, 23, .78);
  border-top: 1px solid rgba(195, 162, 80, .72);
}

.stage-copy h2 {
  margin: 2px 0 8px;
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: 1.45rem;
}

.stage-copy p {
  margin: 0;
  color: rgba(231, 223, 200, .82);
  line-height: 1.55;
}

.system-verdict {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--gold);
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: .77rem;
  font-weight: 800;
}

.scene-center {
  display: grid;
  min-height: 160px;
  place-items: center;
}

.sixth-seat-mark {
  display: grid;
  width: 120px;
  height: 146px;
  padding: 14px 10px;
  place-items: end center;
  border: 1px solid rgba(231, 223, 200, .28);
  background: rgba(12, 12, 11, .7);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .35);
  color: rgba(231, 223, 200, .68);
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: .72rem;
}

.sixth-seat-mark::before {
  width: 56px;
  height: 88px;
  content: "";
  background: var(--ink);
  clip-path: polygon(16% 0, 84% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(231, 223, 200, .12);
}

.feedback-band {
  width: min(640px, 92%);
  min-height: 62px;
  padding: 10px 14px;
  background: rgba(231, 223, 200, .88);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

.log-line {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  line-height: 1.4;
}

.log-line + .log-line {
  margin-top: 5px;
}

.speaker {
  color: var(--rust-dark);
  font-weight: 800;
}

.inspector-section {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.inspector-section h3 {
  margin: 0 0 10px;
  color: rgba(231, 223, 200, .66);
  font-size: .72rem;
}

.identity-seal {
  display: flex;
  min-height: 50px;
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(231, 223, 200, .22);
  background: rgba(231, 223, 200, .05);
}

.identity-seal.exposed {
  border-color: var(--bone);
  box-shadow: inset 4px 0 var(--bone);
}

.trial-objective,
.threshold-note {
  margin-top: 9px;
  padding: 8px 9px;
  background: rgba(231, 223, 200, .05);
  color: rgba(231, 223, 200, .7);
  font-size: .68rem;
  line-height: 1.45;
}

.trial-objective strong,
.trial-objective span {
  display: block;
}

.trial-objective strong {
  color: var(--gold);
}

.seal-label {
  color: rgba(231, 223, 200, .58);
  font-size: .68rem;
}

.seal-value {
  font-family: "SimSun", "Noto Serif SC", serif;
  font-weight: 800;
}

.private-order {
  border-left: 3px solid var(--rust);
  color: #e0b7ad;
  line-height: 1.5;
}

.evidence-list,
.memory-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li,
.memory-list li {
  position: relative;
  padding: 7px 0 7px 17px;
  border-bottom: 1px solid rgba(231, 223, 200, .1);
  color: rgba(231, 223, 200, .8);
  line-height: 1.35;
  font-size: .72rem;
}

.evidence-list li::before {
  position: absolute;
  top: 11px;
  left: 0;
  width: 8px;
  height: 8px;
  content: "";
  border: 1px solid var(--bone);
}

.empty-state {
  color: rgba(231, 223, 200, .42);
  font-size: .72rem;
}

.action-deck {
  min-height: 205px;
  padding: 14px 22px 16px;
  border-top: 1px solid var(--line);
  background: rgba(19, 19, 18, .96);
}

.action-deck-inner {
  display: grid;
  height: 100%;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
}

.deck-copy {
  min-width: 0;
}

.deck-heading {
  display: flex;
  min-height: 30px;
  margin-bottom: 8px;
  align-items: center;
  justify-content: space-between;
}

.deck-heading h3 {
  margin: 0;
  font-size: .86rem;
}

.selection-note {
  color: var(--gold);
  font-size: .72rem;
}

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

.action-option,
.claim-option,
.reaction-option,
.declaration-option,
.ending-option {
  position: relative;
  min-height: 116px;
  padding: 11px 12px;
  border: 1px solid rgba(231, 223, 200, .22);
  background: rgba(231, 223, 200, .04);
  text-align: left;
}

.action-option:hover,
.claim-option:hover,
.reaction-option:hover,
.declaration-option:hover,
.ending-option:hover:not(:disabled) {
  border-color: rgba(195, 162, 80, .8);
  background: rgba(195, 162, 80, .08);
}

.action-option.selected,
.claim-option.selected,
.declaration-option.selected {
  border-color: var(--gold);
  background: rgba(195, 162, 80, .12);
  box-shadow: inset 0 -3px var(--gold);
}

.option-icon {
  display: grid;
  width: 25px;
  height: 25px;
  margin-bottom: 9px;
  place-items: center;
  border: 1px solid currentColor;
  color: var(--gold);
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: .7rem;
}

.option-title {
  display: block;
  margin-bottom: 5px;
  font-weight: 800;
}

.option-detail {
  display: block;
  color: rgba(231, 223, 200, .62);
  font-size: .7rem;
  line-height: 1.4;
}

.option-meta {
  display: flex;
  margin-top: 7px;
  flex-wrap: wrap;
  gap: 4px;
}

.option-meta span {
  padding: 2px 5px;
  border: 1px solid rgba(195, 162, 80, .38);
  color: var(--paper-bright);
  font-size: .62rem;
  line-height: 1.2;
}

.deck-submit {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
}

.deck-submit .primary-command,
.deck-submit .secondary-command {
  width: 100%;
}

.inline-error {
  min-height: 34px;
  margin: 0;
  color: #e1a197;
  font-size: .72rem;
  line-height: 1.35;
}

.claim-screen,
.finale-screen,
.result-screen {
  display: grid;
  padding: 70px 7vw;
  place-items: center;
}

.decision-sheet,
.result-sheet {
  width: min(980px, 86vw);
  padding: 28px;
  border-top: 2px solid var(--gold);
  border-bottom: 1px solid rgba(231, 223, 200, .32);
  background: rgba(24, 24, 23, .92);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .38);
}

.decision-sheet h1,
.result-sheet h1 {
  margin: 5px 0 10px;
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: 2.1rem;
}

.decision-lede {
  max-width: 660px;
  margin: 0 0 22px;
  color: rgba(231, 223, 200, .72);
  line-height: 1.55;
}

.claim-grid,
.ending-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.claim-option,
.ending-option {
  min-height: 130px;
}

.ending-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ending-option.locked {
  opacity: .45;
}

.ending-option small {
  display: block;
  margin-top: 7px;
  color: rgba(231, 223, 200, .6);
  line-height: 1.4;
}

.reaction-grid,
.declaration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.reaction-option,
.declaration-option {
  min-height: 108px;
}

.result-sheet {
  width: min(840px, 78vw);
}

.result-verdict {
  margin: 18px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  background: rgba(231, 223, 200, .06);
  line-height: 1.55;
}

.result-detail {
  color: rgba(231, 223, 200, .76);
  line-height: 1.6;
}

.callback-list {
  display: grid;
  margin: 22px 0;
  gap: 7px;
}

.callback {
  padding: 9px 12px;
  border-left: 1px solid rgba(231, 223, 200, .4);
  background: rgba(231, 223, 200, .04);
  color: rgba(231, 223, 200, .78);
  font-size: .78rem;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.gravefire-flash {
  animation: gravefire 620ms var(--ease) both;
}

.settings-dialog {
  width: 360px;
  padding: 18px;
  border: 1px solid rgba(231, 223, 200, .3);
  border-radius: 5px;
  background: #22211f;
  color: var(--paper-bright);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, .62);
}

.dialog-heading,
.toggle-row,
.scale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-heading {
  margin-bottom: 8px;
}

.toggle-row,
.scale-row {
  min-height: 48px;
  border-top: 1px solid var(--line);
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
}

.scale-row select {
  min-width: 110px;
  padding: 6px 8px;
  border: 1px solid rgba(231, 223, 200, .25);
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper-bright);
}

.viewport-warning {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: none;
  padding: 28px;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: var(--ink);
  text-align: center;
}

.viewport-warning strong {
  color: var(--gold);
  font-family: "SimSun", "Noto Serif SC", serif;
  font-size: 1.4rem;
}

.viewport-warning span {
  color: rgba(231, 223, 200, .68);
}

@keyframes gravefire {
  0% { box-shadow: inset 0 0 0 rgba(241, 232, 206, 0); }
  45% { box-shadow: inset 0 0 80px rgba(241, 232, 206, .26); }
  100% { box-shadow: inset 0 0 0 rgba(241, 232, 206, 0); }
}

@media (max-width: 1179px), (max-height: 679px) {
  .viewport-warning {
    display: grid;
  }
}

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

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: .01ms !important;
  transition-duration: .01ms !important;
}
