/* Ending cutscene (#ending) and result screen (#result). Built by js/endings.js and js/share.js. */

/* ---- ending cutscene ---- */
#ending {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  color: #ddd6c8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  font-family: inherit;
}
#ending .ending-shot {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#ending .ending-shot.show {
  opacity: 1;
}
#ending canvas {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  max-height: 52vh;
  object-fit: contain;
  border: 1px solid #1d1a18;
  background: #0b0909;
}
#ending .ending-lines {
  width: 100%;
  text-align: center;
  font-size: calc(17px * var(--ending-font, 1));
  line-height: 2;
  letter-spacing: 0.06em;
  min-height: 3em;
}
#ending .ending-line {
  opacity: 0;
  transition: opacity 1.2s ease;
  margin: 0.2em 0;
  white-space: pre-line;
}
#ending .ending-line.show {
  opacity: 1;
}
#ending .ending-line.time {
  font-size: 0.82em;
  color: #8a8272;
  letter-spacing: 0.2em;
}
#ending .ending-line.sys {
  display: inline-block;
  border: 1px solid #9c2a2a;
  color: #c9504a;
  padding: 2px 14px;
}
#ending .ending-line.voice {
  color: #ddd6c8;
}
#ending .ending-line.quiet {
  color: #8a8272;
  font-size: 0.9em;
}
#ending .ending-line.title {
  font-size: 2.6em;
  letter-spacing: 0.3em;
  color: #ddd6c8;
  margin-top: 0.4em;
}
#ending .ending-skip {
  position: absolute;
  top: 14px;
  right: 16px;
  font: inherit;
  font-size: 13px;
  color: #8a8272;
  background: transparent;
  border: 1px solid #3a3530;
  padding: 5px 12px;
  cursor: pointer;
  z-index: 1;
}
#ending .ending-skip:hover {
  color: #ddd6c8;
  border-color: #8a8272;
}
#ending .ending-next {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: #5a544c;
  opacity: 0;
  transition: opacity 0.8s;
  pointer-events: none;
}
#ending .ending-next.show {
  opacity: 1;
}

/* ---- result ---- */
#result {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: block;
  background: #0b0909;
  color: #ddd6c8;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  font-family: inherit;
}
#result.hidden {
  display: none;
}
#result .result-panel {
  max-width: 560px;
  margin: 0 auto;
  padding: 36px 16px 48px;
  box-sizing: border-box;
  text-align: center;
}
#result .result-code {
  font-size: 26px;
  letter-spacing: 0.12em;
  color: #ddd6c8;
  margin-bottom: 6px;
}
#result .result-tone {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.2em;
  color: #c9504a;
  border: 1px solid #9c2a2a;
  padding: 2px 12px;
  margin-bottom: 18px;
}
#result .result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
}
#result .result-stats div {
  border: 1px solid #2a2522;
  padding: 8px 4px;
}
#result .result-stats dt {
  font-size: 12px;
  opacity: 0.65;
}
#result .result-stats dd {
  margin: 2px 0 0;
  font-size: 26px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}
#result .result-test {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 8px;
}
#result .result-head {
  font-size: 15px;
  font-weight: normal;
  letter-spacing: 0.15em;
  margin: 26px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #9c2a2a;
  text-align: left;
}
#result .result-sub {
  font-size: 13px;
  opacity: 0.7;
  text-align: left;
  margin: 14px 0 4px;
}
#result ul {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
}
#result .result-history li {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dotted #2a2522;
  font-size: 14px;
  line-height: 1.5;
}
#result .r-at {
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
  font-size: 13px;
}
#result .r-kind {
  font-size: 12px;
  padding: 0 6px;
  border: 1px solid;
}
#result .r-kind.adopt {
  color: #c9504a;
  border-color: #9c2a2a;
}
#result .r-kind.revoke {
  color: #a9a296;
  border-color: #5a544c;
}
#result .r-empty {
  font-size: 14px;
  opacity: 0.6;
  padding: 5px 0;
}
#result .result-world li {
  padding: 5px 0;
  border-bottom: 1px dotted #2a2522;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}
#result .r-change {
  font-size: 13px;
  opacity: 0.7;
}
#result .r-change::before {
  content: '→ ';
  color: #9c2a2a;
}
#result .result-slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
#result .result-slots li {
  border: 1px solid #2a2522;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  color: #5a544c;
}
#result .result-slots li.got {
  color: #ddd6c8;
  border-color: #4a423c;
}
#result .result-slots li.now {
  border-color: #9c2a2a;
}
#result .slot-code {
  font-size: 12px;
  letter-spacing: 0.1em;
  opacity: 0.7;
}
#result .slot-name {
  font-size: 16px;
}
#result .result-ask {
  font-size: 14px;
  line-height: 1.8;
  margin: 26px 0 8px;
}
#result .result-text {
  font-size: 12px;
  opacity: 0.75;
  white-space: pre-line;
  background: #151211;
  border: 1px solid #2a2522;
  padding: 8px 10px;
  text-align: left;
  line-height: 1.7;
}
#result .share-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0 6px;
}
#result button {
  font: inherit;
  font-size: 15px;
  padding: 10px 6px;
  background: #1d1918;
  color: #ddd6c8;
  border: 1px solid #4a423c;
  cursor: pointer;
}
#result button:hover {
  background: #2e2220;
}
#result .share-x {
  background: #000;
  border-color: #888;
}
#result .share-fb {
  background: #1b3d78;
  border-color: #2d5bb0;
}
#result .share-line {
  background: #06803a;
  border-color: #0aa64c;
}
#result .share-ig {
  background: linear-gradient(45deg, #b8860b, #c1355b, #6a3cb0);
  border-color: #a4507a;
}
#result .result-note {
  min-height: 1.6em;
  margin: 6px 0;
  font-size: 13px;
  color: #e8d9a0;
}
#result .result-buttons {
  margin-top: 18px;
}
#result .result-title {
  min-width: 200px;
  border-color: #9c2a2a;
}

@media (max-width: 420px) {
  #ending .ending-line.title {
    font-size: 2em;
  }
  #result .result-code {
    font-size: 22px;
  }
  #result .result-stats dd {
    font-size: 22px;
  }
}
