/* 拘束室の画面、質問・行動ボタン、通信・判定演出。 */

.detained {
  max-width: 526px;
  margin: 16px auto 0;
}

.detainedScene {
  height: 250px;
  border: 1px solid #272b30;
}

.detainedText {
  min-height: 112px;
  margin-top: 12px;
  padding: 17px 20px;
}

.detainedReplyBlock {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.detainedGroupHeading {
  font-size: 12px;
  color: #58656a;
  font-weight: 600;
  margin: 0 0 7px;
}

.detained #detainedChoices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.detained #detainedChoices button {
  flex: 1 1 132px;
  min-width: 0;
  min-height: 46px;
  background: #e0e5e5;
  border: 1px solid #a5b1b4;
  color: #293940;
}

.detainedActionBlock {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #c8d0d1;
}

.detainedActions {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 7px;
  margin: 0;
}

.detainedActions button {
  min-width: 0;
  min-height: 38px;
  padding: 7px 5px;
  font-size: 12px;
  background: #f8f8f8;
}

.detention-question-reminder:not([hidden]) {
  overflow-wrap: anywhere;
}

@media (max-width:530px) {
  .detainedScene {
    height: 205px;
  }
  .detainedText {
    min-height: 100px;
    padding: 13px 16px;
  }
  .detainedActions {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
  .detainedActions button {
    font-size: 12px;
    min-height: 43px;
  }
}

/* 選択肢は常に一群だけ。通常行動メニューを尋問中に並べない。 */

.detainedText #detainedMessage, #detainedMessage {
  white-space: pre-line;
}

.detained [hidden] {
  display: none !important;
}

.detainedEndStatus {
  position: absolute;
  top: 12px;
  left: 14px;
  color: #d1d9da;
  font-size: 12px;
  letter-spacing: .04em;
  background: rgba(20,24,27,.45);
  padding: 4px 7px;
  border-radius: 2px;
}

html:has(#detained:not([hidden])):has(#intro[hidden]) {
  background: #030305;
  color: #eef0f1;
}

#detained {
  max-width: none;
  margin: 19px 0 0;
}

#detained .detainedScene {
  height: auto;
  aspect-ratio: 1;
  border: 0;
  background: #000;
  margin: 0 auto;
}

#detained .detainedScene::before {
  content: none;
}

#detained .detainedScene img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#detained .detainedCameraImage {
  opacity: 0;
}

#detained .detained-camera-visible .detainedCameraImage {
  opacity: 1;
}

#detained .detained-crossfade .detainedCameraImage {
  transition: opacity .4s ease-in-out;
}

#detained .detainedRestraint {
  z-index: 2;
  color: #eef0f1;
  text-shadow: 0 1px 4px #000;
}

#detained .detainedEndStatus {
  z-index: 2;
}

#detained .detainedText {
  margin-top: 30px;
  background: #1b2126;
  color: #edf1f3;
  border-color: #525d65;
  border-radius: 3px;
}

#detained .detainedSpeaker {
  color: #bdc6cd;
}

#detained #detainedChoices button, #detained .detainedActions button {
  background: #252a30;
  color: #e8edef;
  border-color: #56616a;
  border-radius: 3px;
}

#detained #detainedChoices button:hover, #detained .detainedActions button:hover {
  background: #303840;
}

#detained #detainedChoices button:active, #detained .detainedActions button:active {
  background: #38444c;
}

#detained .detainedActionBlock {
  border-top: 0;
  padding-top: 0;
}

body:has(#detained:not([hidden])):has(#intro[hidden]) .footer {
  border-top-color: #333b42;
}

body:has(#detained:not([hidden])):has(#intro[hidden]) .footer .muted {
  color: #909ca6;
}

body:has(#detained:not([hidden])):has(#intro[hidden]) #reset {
  background: #262c32;
  border-color: #57616b;
  color: #ebedf0;
}

@keyframes detention-communication-glow {
  0%,100% {
    border-color: #525d65;
    box-shadow: none;
  }
  22%,67% {
    border-color: #a5c0d0;
    box-shadow: 0 0 0 3px rgba(143,177,197,.36),0 0 15px rgba(143,177,197,.18);
  }
}

#detained .detained-autonomous-utterance {
  animation: detention-communication-glow 900ms ease-in-out 1;
}

@media(max-width:530px) {
  #detained {
    margin-top: 9px;
  }
  #detained .detainedText {
    margin-top: 20px;
  }
}

@media(prefers-reduced-motion:reduce) {
  #detained .detained-crossfade .detainedCameraImage {
    transition: none;
  }
  #detained .detained-autonomous-utterance {
    animation: none;
  }
}

#response.forced-choice {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 9px;
}

#response.forced-choice button {
  flex: 0 1 45%;
  max-width: 220px;
  background: #FFFFFF;
  border-color: #BFC7C9;
  color: #263039;
  opacity: 1;
}

#response.forced-choice button:hover {
  background: #f0f3f3;
}

#response.forced-choice button:active {
  background: #dce5e7;
  transform: translateY(1px);
}

@keyframes detention-no-disappear {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(.96);
  }
}

#response.forced-choice .vanishing-no {
  animation: detention-no-disappear .35s ease-out both;
  pointer-events: none;
}

#detentionNotice {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 0 22px;
  background: transparent;
  color: #263039;
}

#detentionNotice[hidden] {
  display: none;
}

#detentionNotice button {
  font-size: 19px;
  line-height: 1.9;
  padding: 26px 18px;
  border-color: #C9CFD1;
  color: #263039;
  background: white;
  width: min(100%, 526px);
}

body:has(#detentionNotice:not([hidden])) .footer {
  display: none;
}

body:has(#intro:not([hidden])) #detentionNotice {
  display: none!important;
}

#detentionBlackout {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  transition: opacity .36s ease-in-out;
}

#detentionBlackout.active {
  opacity: 1;
}

#detentionBlackout.locked {
  pointer-events: auto;
}

@media(max-width:530px) {
  #detentionNotice {
    padding: 0 14px;
  }
  #detentionNotice button {
    font-size: 17px;
  }
}

@media(prefers-reduced-motion:reduce) {
  #detentionBlackout {
    transition: none;
  }
  #response.forced-choice .vanishing-no {
    animation: none;
    opacity: 0;
  }
}

#detainedSpeaker[hidden] {
  display: none!important;
}

#detained #detainedChoices {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
}

#detained #detainedChoices:has(button:only-child) {
  grid-template-columns: 1fr;
}

#detained #detainedChoices:has(button:nth-child(4)) {
  grid-template-columns: repeat(2,minmax(0,1fr));
}

#detained #detainedChoices button {
  font-size: 13px;
  padding: 7px 4px;
}

.detention-report {
  position: fixed;
  inset: 0;
  background: #000;
  color: #fff;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  z-index: 99;
}

.detention-report[hidden] {
  display: none!important;
}

.detention-report::-webkit-scrollbar {
  display: none;
}

.detention-report-inner {
  box-sizing: border-box;
  width: min(100%,650px);
  margin: auto;
  padding: 38px 25px 36px;
  font-family: "Courier New",Courier,monospace;
  font-size: 14px;
  line-height: 1.52;
  font-weight: 400;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detention-report-signature {
  text-align: right;
  white-space: pre-wrap;
}

.detention-report-blink {
  animation: detention-report-flash 1s steps(1,end) infinite;
}

@keyframes detention-report-flash {
  0%,100% {
    opacity: 1
  }
  50% {
    opacity: 0
  }
}

@media(prefers-reduced-motion:reduce) {
  .detention-report-blink {
    animation: none
  }
}

@media(max-width:530px) {
  .detention-report-inner {
    padding: 24px 16px 30px;
    font-size: 12px;
  }
}

body:has(#detentionReport:not([hidden])) .footer {
  display: none;
}

/* Text wrapping and typography for the detention screen. */

#detained #detainedMessage {
  display: block;
  white-space: pre-wrap;
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: wrap;
  text-spacing-trim: trim-auto;
}

#detained #detainedChoices button, #detained .detainedActions button {
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
}

#detained .detainedText {
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: .012em;
}

#detained #detainedAside:not([hidden]) {
  display: block;
  margin: 0 0 .5em;
  white-space: pre-wrap;
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: wrap;
  text-spacing-trim: trim-auto;
}

@media(max-width:530px) {
  #detained .detainedText {
    line-height: 1.6;
  }
}

/* Ending collection is deliberately subordinate to the final room image. */
.detention-ending-badge { color: #999; }
.detention-ending-badge .ending-title { color: #B6B6B6; }
.detention-report .close-report { display: block; margin: 18px 0 0 auto; padding: 8px 15px; min-height: 40px; border: 1px solid #666; border-radius: 3px; background: #000; color: #CCC; font: inherit; cursor: pointer; }

/* The completed detention room stays untouched until the restart request. */
.detention-end-dialog { box-sizing:border-box; width:min(360px, calc(100% - 32px)); max-width:100%; padding:24px; border:1px solid #444; border-radius:5px; background:#171717; color:#DEDEDE; font-family:inherit; }
.detention-end-dialog:not([open]) { display:none; }
.detention-end-dialog::backdrop { background:rgba(0,0,0,.60); }
.detention-end-dialog h2 { margin:0 0 14px; font-size:13px; letter-spacing:.07em; font-weight:600; }
.detention-end-dialog .ending-badge { margin:0; gap:10px; }
.detention-end-dialog .ending-title-line { background:#272727; --medal-center:#272727; }
.detention-end-dialog .ending-title-line .medal { color:#949494; }
.detention-end-dialog .ending-title { color:#C8C8C8; }
.detention-end-dialog p { margin:20px 0 16px; font-size:14px; line-height:1.6; }
.detention-dialog-actions { display:flex; justify-content:flex-end; gap:8px; }
.detention-dialog-actions button { min-height:40px; border:1px solid #555; border-radius:4px; background:#252525; color:#DDD; font:inherit; font-size:13px; padding:7px 15px; cursor:pointer; }
.detention-dialog-actions button:focus-visible { outline:2px solid #AAA; outline-offset:2px; }
@media(max-width:350px) { .detention-end-dialog { padding:18px; } }

/* Detention has its own quiet, legible dialog; no chip background. */
.detention-end-dialog {padding:21px 22px;width:min(340px,calc(100% - 32px))}
.detention-end-dialog h2 {margin:0 0 14px;color:#E5E5E5}
#detentionEndingBadge {align-items:center;gap:6px}
#detentionEndDialog .ending-title-line {background:none;padding:0;gap:8px;--medal-center:#171717}
#detentionEndDialog .ending-title {font-size:16px;color:#E3E3E3}
#detentionEndingTotal {font-size:11px;color:#A9A9A9}
.detention-end-dialog p {margin:16px 0 15px}

/* Do not paint the default start screen while a saved scene is being restored. */
html.restoring-scene { background: #000; }
html.restoring-scene body { visibility: hidden; }
