:root {
  font-family: -apple-system,BlinkMacSystemFont,"Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
  color: #29343a;
  background: #f5f5f3
}

* {
  box-sizing: border-box
}

[hidden] {
  display: none!important
}

body {
  margin: 0
}

main {
  max-width: 570px;
  margin: 28px auto 56px;
  padding: 0 22px
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 13px;
  border-bottom: 1px solid #dcdedc
}

h1 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .025em;
  margin: 0
}

.muted {
  font-size: 11px;
  color: #777f82
}

/* Preserve the source image's square composition. No cropping. */

.visual {
  margin: 19px 0 0
}

.portrait {
  width: min(100%,400px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  background: #d7d9d8;
  border-radius: 3px
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain
}

.visual aside {
  display: none
}

.feed {
  margin-top: 16px
}

.feed h2,.history {
  display: none
}

.current {
  min-height: 147px;
  padding: 21px 25px 23px;
  background: #fff;
  border: 1px solid #dfe1e0;
  border-radius: 3px;
  color: #29343a;
  line-height: 1.75;
  font-size: 16px;
  letter-spacing: .012em;
  overflow-wrap: anywhere;
  white-space: pre-wrap
}

.speaker {
  display: block;
  height: 23px;
  margin-bottom: 8px;
  color: #435c68;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .015em;
  line-height: 23px
}

.current.narration {
  color: #455158
}

.current.narration .speaker {
  visibility: hidden
}

.controls,.response {
  display: flex;
  gap: 9px;
  margin-top: 13px
}

.controls {
  flex-wrap: wrap
}

.controls button {
  flex: 1 1 130px
}

button {
  border: 1px solid #cbd1d2;
  border-radius: 3px;
  background: #fff;
  color: #2b3c44;
  padding: 11px 12px;
  min-height: 46px;
  font: inherit;
  font-size: 14px;
  cursor: pointer
}

button:hover {
  background: #f0f3f3
}

button:focus-visible,input:focus-visible,summary:focus-visible {
  outline: 2px solid #547a8e;
  outline-offset: 2px
}

.response button {
  flex: 1
}

.sweetform {
  margin-top: 12px;
  padding: 14px;
  background: #e9eded;
  border-radius: 3px
}

.sweetform label {
  font-size: 13px;
  display: block;
  margin-bottom: 9px
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

input {
  flex: 1 1 170px;
  min-width: 0;
  padding: 10px;
  font-size: 16px;
  border: 1px solid #b6c0c3;
  border-radius: 3px
}

.end {
  margin-top: 14px;
  padding: 15px;
  background: #e7ece9;
  border: 1px solid #c5d0c9;
  line-height: 1.8
}

.end h2 {
  font-size: 16px;
  margin: 0 0 7px
}

.end p {
  margin: 0 0 12px;
  white-space: pre-wrap
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 23px;
  padding-top: 12px;
  border-top: 1px solid #dcdedc
}

.footer button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 12px
}

.dev {
  margin-top: 16px;
  padding: 12px;
  border: 1px dashed #b5bfc2;
  background: #edf0f0;
  font-size: 12px
}

.dev summary {
  cursor: pointer
}

.devgrid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0
}

.dev button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px
}

.dev pre {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 12px
}

.note {
  display: none
}

@media(max-width:530px) {
  main {
    margin: 0;
    padding: 0 14px 35px
  }
  .visual {
    margin-top: 14px
  }
  .portrait {
    width: min(100%,360px)
  }
  .feed {
    margin-top: 12px
  }
  .current {
    padding: 17px 18px 19px;
    min-height: 140px;
    font-size: 16px
  }
  .controls {
    gap: 7px
  }
  .controls button {
    flex: 1 1 30%;
    min-width: 0;
    padding: 10px 4px;
    font-size: 13px;
    min-height: 49px
  }
  .footer .muted {
    font-size: 11px
  }
}

button:active {
  background: #dce5e7;
  transform: translateY(1px)
}

@media(max-width:360px) {
  .controls button {
    flex-basis: 100%
  }
}

/* Branch replies can contain longer neutral phrases; no extra UI panels. */

.response {
  flex-wrap: wrap
}

.response button {
  flex: 1 1 145px
}

@media (prefers-reduced-motion:reduce) {
  button {
    transition: none
  }
}

.detained {
  margin: 18px 0 0
}

.detainedScene {
  height: 290px;
  background: #373b40;
  position: relative;
  overflow: hidden;
  border: 1px solid #2c2f33
}

.detainedScene:before {
  content: '';
  position: absolute;
  left: 22%;
  right: 22%;
  top: 0;
  height: 100%;
  border-left: 2px solid #51565b;
  border-right: 2px solid #51565b
}

.door {
  position: absolute;
  left: 42%;
  top: 18%;
  height: 62%;
  width: 20%;
  border: 2px solid #24282b;
  background: #303438
}

.door:after {
  content: '';
  position: absolute;
  right: 9px;
  top: 53%;
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: #777
}

.restraint {
  position: absolute;
  z-index: 1;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: #bfc4c5;
  font-size: 13px
}

.detainedText {
  min-height: 140px;
  background: #e3e5e5;
  padding: 23px;
  white-space: pre-wrap;
  line-height: 1.8
}

.detained #detainedChoices {
  display: flex;
  flex-wrap: wrap
}

.detained #detainedChoices button {
  flex: 1 1 130px
}

.detained #detainedEnd {
  text-align: center;
  margin: 18px 0 0
}

.meters {
  margin: 16px auto 0;
  max-width: 400px;
  display: grid;
  gap: 7px
}

.meter {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 11px;
  align-items: center;
  font-size: 12px;
  color: #52616a;
  white-space: pre-wrap;
  line-break: strict;
  overflow-wrap: anywhere;
}

.track {
  white-space: normal;
  height: 7px;
  border-radius: 6px;
  background: #dfe5e6;
  overflow: hidden
}

.track>div {
  height: 100%;
  width: 0;
  background: #829ca8;
  transition: width .3s
}

.meter:first-child .track>div {
  background: #b18d8a
}

#bondMeter .track>div {
  background: #9b9cae
}

.sweetPicks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 12px
}

.sweetPicks button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px
}

.sweetform label {
  margin-bottom: 3px
}

.sweetform .row #give {
  flex: 1 1 160px
}

.detained #detainedChoices {
  gap: 8px
}

.detained #detainedChoices button {
  min-height: 43px
}

/* Sweet selection buttons */

.sweetform {
  padding: 12px 0 0;
  background: transparent;
  border-top: 1px solid #dfe1e0
}

.sweetPicks {
  gap: 6px;
  margin: 9px 0
}

.sweetPicks button {
  min-height: 42px;
  padding: 9px 12px
}

.sweetform .row {
  gap: 7px
}

.sweetform .row button {
  flex: 0 1 auto
}

.sweetform .row #give {
  flex: 1 1 130px
}

.dev select {
  padding: 8px;
  border: 1px solid #b5bfc2;
  border-radius: 3px;
  background: #fff;
  max-width: 100%
}

/* Question response panel */

.response.question {
  padding: 18px 12px;
  margin-top: 16px;
  border: 1px solid #9caeac;
  border-radius: 8px;
  background: #edf3f1;
}

#waitReturn {
  display: block;
  margin: 14px auto;
  padding: 12px 30px;
}

#waitReturn[hidden] {
  display: none;
}

/* Detained: interrogation answers and physical actions remain distinguishable. */

.detained #detainedChoices button[data-kind="reply"] {
  background: #dce3e3;
  border-color: #a5b1b4
}

.detained #detainedChoices button[data-kind="action"] {
  background: #fff
}

.detained #detainedChoices {
  display: grid;
  gap: 16px;
  margin-top: 15px
}

.detainedGroup {
  min-width: 0
}

.detainedGroupTitle {
  font-size: 12px;
  color: #536067;
  margin-bottom: 7px;
  font-weight: 600
}

.detainedGroupButtons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px
}

.detainedGroupButtons button {
  flex: 1 1 135px;
  max-width: 100%;
  min-height: 43px
}

.detainedGroupButtons button[data-kind="reply"] {
  background: #dce3e3
}

.detainedGroupButtons button[data-kind="action"] {
  background: #fff
}

/* Detention action and response layout */

.detained #detainedChoices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px
}

.detained #detainedChoices[hidden],.detainedActions[hidden] {
  display: none!important
}

.detained #detainedChoices button {
  flex: 1 1 145px;
  min-height: 44px;
  background: #e0e5e5;
  border-color: #a5b1b4
}

.detainedActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0
}

.detainedActions button {
  flex: 1 1 130px;
  min-height: 44px
}

.detained .detainedText {
  min-height: 110px
}

.intro {
  padding: 2rem 1.5rem;
  margin: 1.2rem 0;
  border: 1px solid #50545d;
  border-radius: 12px;
  background: #20242b;
  text-align: center
}

.intro h2 {
  font-size: 1.45rem;
  margin: 0 0 1.5rem
}

.intro p {
  line-height: 1.9;
  max-width: 34rem;
  margin: 1rem auto
}

.intro button {
  margin: 1.5rem auto 0;
  min-width: 12rem;
  padding: .8rem
}

body:has(.intro:not([hidden])) #play,body:has(.intro:not([hidden])) #detained,body:has(.intro:not([hidden])) .footer,body:has(.intro:not([hidden])) .dev,body:has(.intro:not([hidden])) .note {
  display: none!important
}

.intro {
  color: #f0f2f3
}

.intro h2,.intro p {
  color: #f0f2f3
}

.intro button {
  color: #26323a;
  background: #fff
}

@media (max-width: 530px) {
  main {
    padding: 0 14px 40px;
  }
  header {
    padding: 11px 0 9px;
  }
  .visual {
    margin-top: 9px;
  }
  .portrait {
    width: min(100%, 220px);
  }
  .meters {
    margin-top: 10px;
    gap: 7px;
  }
  .feed {
    margin-top: 10px;
  }
  .current {
    min-height: 106px;
    padding: 12px 15px 14px;
    line-height: 1.6;
    font-size: 16px;
  }
  .speaker {
    margin-bottom: 4px;
    height: 21px;
    line-height: 21px;
  }
  .controls, .response {
    margin-top: 10px;
    gap: 7px;
  }
  .controls button {
    flex: 1 1 30%;
    min-height: 50px;
    padding: 10px 4px;
    font-size: 13px;
  }
  .footer {
    margin-top: 17px;
  }
  .detainedScene {
    height: 205px;
  }
  .detainedText {
    padding: 15px;
    min-height: 100px;
  }
}

@media (max-width: 360px) {
  .controls button {
    flex: 1 1 30%;
  }
  .portrait {
    width: min(100%, 195px);
  }
}

.deskStatus {
  max-width: 400px;
  margin: 10px auto 0;
  padding: 8px 11px;
  border: 1px solid #d3d8d8;
  background: #fff;
  font-size: 13px;
  color: #45545a
}

/* Outstanding detention question reminder */

.detention-question-reminder:not([hidden]) {
  margin-top: 10px;
  padding: 9px 12px;
  border-left: 2px solid #9caeac;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  color: #455158;
  background: #f5f6f5
}

.sceneAside:not([hidden]) {
  display: block;
  margin-top: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit
}

.detained {
  margin: 17px 0 0;
}

.detainedScene {
  height: 285px;
  position: relative;
  overflow: hidden;
  border: 1px solid #25282c;
  background: linear-gradient(160deg,#3c4146,#292d31 85%);
}

.detainedScene::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 19%;
  right: 19%;
  border-left: 2px solid #464a4e;
  border-right: 2px solid #464a4e;
}

.detainedDoor {
  position: absolute;
  top: 17%;
  left: 40%;
  width: 24%;
  height: 64%;
  border: 2px solid #202327;
  background: #303439;
  box-shadow: inset 0 0 0 1px #3a3f43;
}

.detainedDoor::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 54%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8a9297;
}

.detainedIntercom {
  position: absolute;
  top: 36%;
  left: 72%;
  height: 42px;
  width: 24px;
  border: 2px solid #25292e;
  background: #41474b;
}

.detainedIntercom i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8baca3;
  margin: 8px auto;
  box-shadow: 0 10px 0 #666f74;
}

.detainedRestraint {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: #c3c8c9;
  letter-spacing: .035em;
}

.detainedText {
  min-height: 129px;
  margin-top: 13px;
  padding: 19px 22px 21px;
  background: #e4e6e6;
  color: #29343a;
  border: 1px solid #c5cbd0;
  border-radius: 2px;
  line-height: 1.8;
  font-size: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detainedSpeaker {
  display: block;
  min-height: 22px;
  margin-bottom: 8px;
  font-weight: 650;
  font-size: 15px;
  color: #425764;
}

.detainedText.narration .detainedSpeaker {
  visibility: hidden;
}

.detainedChoices {
  margin-top: 12px;
  padding: 12px;
  background: #e9ecec;
  border: 1px solid #c7cfd0;
  gap: 9px;
}

.detainedChoices button {
  background: #fdfefe;
  border-color: #aeb9bc;
  flex: 1 1 145px;
}

.detainedActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.detainedActions button {
  flex: 1 1 140px;
  min-height: 46px;
}

#detainedQuestionReminder:not([hidden]) {
  margin-top: 10px;
}

@media (max-width:530px) {
  .detainedScene {
    height: 205px;
  }
  .detainedText {
    min-height: 110px;
    padding: 13px 16px 16px;
    margin-top: 11px;
  }
  .detainedActions button {
    flex: 1 1 42%;
    min-height: 47px;
  }
}

.detention-notice {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding: 2rem 1rem;
  text-align: center;
  background: #0e1015;
  color: #f1f1f1;
  font-size: 1.1rem
}

.detention-notice[hidden] {
  display: none
}

/* C click/tap script: keep each food beat visible until user advances. */

.foodNextArea[hidden] {
  display: none!important
}

.foodNextArea {
  display: flex;
  justify-content: center;
  margin: 12px 0
}

.foodNextArea button {
  width: min(100%,290px);
  min-height: 50px;
  font-size: 16px
}

#sceneParts .scenePart {
  white-space: pre-line;
  font: inherit;
  line-height: inherit;
  margin: 0 0 .5em
}

#sceneParts .scenePart:last-child {
  margin-bottom: 0
}

.rememberedHint {
  margin: .4em 0;
  color: inherit;
  font-size: .95em
}

/* B stage sweet selector opens from the normal action and closes after an offer. */

.sweetform button:disabled,.sweetform input:disabled {
  opacity: .5;
  cursor: not-allowed
}

#play #speaker {
  display: none!important
}

@keyframes l-autonomous-border-brief {
  0%,100% {
    border-color: #C9CFD1;
    box-shadow: none;
  }
  22%,67% {
    border-color: #557d91;
    box-shadow: 0 0 0 3px rgba(104,147,171,.36),0 0 15px rgba(104,147,171,.18);
  }
}

#play .current.l-autonomous-utterance {
  animation: l-autonomous-border-brief 900ms ease-in-out 1;
}

@media (prefers-reduced-motion: reduce) {
  #play .current.l-autonomous-utterance {
    animation: none;
  }
}

:root {
  background: #F9F9F9;
  color: #263039;
}

#play .current, #play .current.narration {
  color: #263039;
  background: #FFFFFF;
  border-color: #C9CFD1;
}

#play .controls button {
  color: #263039;
  border-color: #BFC7C9;
  background: #FFFFFF;
  border-radius: 3px;
}

#play .controls button:hover {
  background: #f0f3f3;
}

#play .controls button:active {
  background: #dce5e7;
}

.footer {
  border-top-color: #E3E6E7;
}

.footer .muted {
  color: #67737A;
}

#reset {
  background: #FFFFFF;
  border-color: #D0D6D8;
  color: #647177;
}

#reset:hover, #play #replay:hover {
  background: #f0f3f3;
}

#reset:active, #play #replay:active {
  background: #dce5e7;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 660px;
  margin: 0;
  padding: 54px 5px 3px;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: center;
  color: #263039;
}

.intro .start-main {
  margin: auto;
}

.intro h2 {
  color: #263039;
  font-size: 28px;
  line-height: 1.45;
  margin: 0 0 34px;
}

.intro .start-text {
  font-size: 17px;
  line-height: 1.65;
  margin: 0 0 35px;
}

.intro .start-text p {
  color: #263039;
  margin: 0;
  line-height: inherit;
}

.intro #startGame {
  min-width: min(215px,100%);
  border: 1px solid #BFC7C9;
  border-radius: 3px;
  background: #fff;
  color: #263039;
  padding: 14px 32px;
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
}

.intro #startGame:hover {
  background: #f0f3f3;
}

.intro #startGame:active {
  background: #dce5e7;
}

.intro .end-count {
  font-size: 13px;
  color: #67737A;
}

.intro .disclaimer {
  border-top: 1px solid #E3E6E7;
  padding-top: 20px;
  font-size: 12px;
  line-height: 1.8;
  color: #67737A;
}

.intro .disclaimer p {
  color: inherit;
  margin: 0;
  line-height: inherit;
}
.intro .disclaimer .intro-version { margin-top: 8px; font-size: 11px; color: #67737A; }

/* Clear result: leave existing dynamic outcomeText untouched. */

#play #outcome {
  background: transparent;
  border: 0;
  border-top: 1px solid #E3E6E7;
  border-radius: 0;
  margin-top: 22px;
  padding: 17px 2px 1px;
  color: #263039;
}

#play #outcome .clear-label {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  color: #263039;
}

#play #outcomeText {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
  margin: 0;
  color: #263039;
  white-space: pre-wrap;
}

#play .retry-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

#play #replay {
  min-height: 38px;
  border: 1px solid #D0D6D8;
  border-radius: 3px;
  color: #647177;
  background: #fff;
  padding: 7px 13px;
  font-size: 13px;
}

@media(max-width:530px) {
  .intro {
    min-height: 555px;
    padding: 32px 3px 5px;
  }
  .intro h2 {
    font-size: 23px;
  }
  .intro .start-text {
    font-size: 15px;
  }
  .intro .disclaimer {
    font-size: 11px;
  }
}

.sweetError {
  margin: 8px 0 0;
  font-size: 13px;
  color: #52616a;
  white-space: pre-wrap;
  line-break: strict;
  overflow-wrap: anywhere;
}

/* Shared Japanese typography. Preserve authored newlines and allow long
   input names to wrap even without a normal line-breaking opportunity.
   The English report has its own typography in detention.css. */
#play .current, #play #sceneParts .scenePart, #play .sceneAside,
#play #outcomeText, #sweetError, #deskStatus, .intro .start-text,
.intro .loop-setting p, .ending-slot, .ending-badge, #detentionNoticeMessage {
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: pretty;
  text-spacing-trim: trim-auto;
}
#play .current, #play #sceneParts .scenePart, #play .sceneAside, #play #outcomeText {
  white-space: pre-wrap;
}
#play #message:not([hidden]) { display: block; }
#play #message, #play #sceneParts .scenePart, #play .sceneAside, #play #outcomeText { text-wrap: wrap; word-break: normal; }
#play .sceneAside:not([hidden]) { margin-top: .5em; }
#play .response button, #play .controls button {
  min-width: 0;
  line-break: strict;
  word-break: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
}
/* Phrase-aware wrapping is progressive enhancement, not a requirement. */
@supports (word-break: auto-phrase) {
  #sweetError {
    word-break: auto-phrase;
  }
}

/* Optional replay UI; independent of the game narrative and gauges. */
.loop-setting { margin: 12px auto 20px; text-align: center; }
.intro .loop-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; background: transparent; color: #444; padding: 8px 4px; font: inherit; font-size: 14px; min-height: 44px; cursor: pointer; }
.intro .loop-toggle { -webkit-tap-highlight-color: transparent; }
.loop-track { position: relative; width: 44px; height: 24px; border-radius: 12px; background: #CFD3D5; flex: none; }
.loop-track::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.loop-toggle.is-on .loop-track { background: #69777D; }
.loop-toggle.is-on .loop-track::after { transform: translateX(20px); }
.loop-status { width: 26px; text-align: left; font-size: 11px; color: #67737A; }
.intro .loop-setting p { color: #67737A; font-size: 12px; line-height: 1.6; margin: 0; }
.ending-collection { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin: 8px auto 0; max-width: 480px; }
.ending-slot { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 46px; padding: 5px 7px; border: 1px solid #D5D5D5; border-radius: 3px; color: #555; font-size: 11px; line-height: 1.5; }
.ending-slot-type { font-size: 10px; color: #67737A; }
.ending-slot.unreached { color: #999; }
.ending-badge { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: #70797d; font-size: 11px; line-height: 1.6; }
.ending-title-line { display: flex; align-items: center; gap: 4px; }
.ending-award { flex: none; }
.ending-badge .ending-title { font-size: 13px; color: #555; }
@media (prefers-reduced-motion: reduce) { .loop-track::after { transition: none; } }

/* Reserve the longest rejection message in the free-input form. No page jump when it appears. */
.sweet-error-slot { display: grid; }
.sweet-error-slot > .sweetError { grid-area: 1 / 1; line-height: 1.6; }
.sweet-error-measure { visibility: hidden; pointer-events: none; line-break: strict; word-break: normal; overflow-wrap: break-word; text-wrap: pretty; text-spacing-trim: trim-auto; }
@supports (word-break: auto-phrase) { .sweet-error-measure { word-break: auto-phrase; } }

/* A stage has preset choices only; do not reserve a hidden free-input error slot there. */
#freeInputRow[hidden] + .sweet-error-slot { display: none; }

/* Author-approved C: one line, quieter end name, medal on a gray title chip. */
#play #outcome .clear-label { display:flex; align-items:center; gap:10px; }
#play #outcome .end-kind { border-left:1px solid #C9CFD1; padding-left:10px; font-size:11px; font-weight:500; letter-spacing:.04em; color:#70797D; }
.ending-title-line { display:inline-flex; align-items:center; gap:7px; padding:5px 10px 5px 8px; background:#E9E9E9; border-radius:6px; --medal-center:#F9F9F9; }
.ending-badge .ending-title { font-size:14px; color:#263039; line-height:1.5; }
.ending-title-line .medal { width:20px; height:23px; color:#777D80; flex:none; }
#endingTotal, #detentionEndingTotal { white-space:nowrap; }
#play #replay:disabled { opacity:.55; cursor:default; }
@media(max-width:350px){ .ending-title-line { padding:5px 7px; gap:5px; } .ending-badge .ending-title { font-size:13px; } }

/* Reserve the larger of the two apple lines only for their automatic replacement. */
#play .current.apple-layout { display:grid; align-content:start; }
#play .current.apple-layout > #message, #play .current.apple-layout > #sceneParts, #play .current.apple-layout > #appleMeasure { grid-area:1 / 1; min-width:0; }
#appleMeasure { visibility:hidden; pointer-events:none; user-select:none; }
#appleMeasure .scenePart { white-space:pre-line; font:inherit; line-height:inherit; margin:0 0 .5em; text-wrap:wrap; line-break:strict; word-break:normal; overflow-wrap:break-word; text-spacing-trim:trim-auto; }
#appleMeasure .scenePart:last-child { margin-bottom:0; }

/* Ending result: aligned replay and title chip, collection count below the chip. */
#play #outcome:not([hidden]) { display:grid; grid-template-columns:minmax(0,1fr) auto; column-gap:12px; row-gap:8px; align-items:start; padding-top:13px; margin-top:15px; }
#play #outcome .clear-label, #play #outcomeText { grid-column:1/-1; margin:0; }
#play #outcomeText { margin-bottom:8px; }
#play #endingBadge { grid-column:2; grid-row:3; display:flex; flex-direction:column; align-items:flex-end; gap:2px; margin:0; }
#play .retry-row { grid-column:1; grid-row:3; justify-content:flex-start; margin:0; }
#play #replay, #play #endingBadge .ending-title-line { box-sizing:border-box; height:40px; min-height:40px; white-space:nowrap; }
#play #endingBadge .ending-title-line { padding:0 10px 0 8px; }
#endingCollection { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:3px; max-width:380px; margin:20px auto 0; align-items:start; }
#endingCollection .ending-slot { border:0; padding:0; min-width:0; gap:4px; }
#endingCollection .ending-slot-type { font-size:9px; letter-spacing:.01em; white-space:nowrap; }
#endingCollection .collection-icon { display:grid; place-items:center; background:#E9E9E9; border-radius:50%; width:35px; height:35px; --medal-center:#E9E9E9; }
#endingCollection .collection-icon .medal { width:23px; height:23px; color:#777D80; }
#endingCollection .unreached { height:35px; border-radius:50%; width:35px; background:#EFEFEF; justify-self:center; color:#A2A7A9; }
.complete-achievement { box-sizing:border-box; max-width:380px; margin:16px auto 0; padding:0 4px; border:0; text-align:center; }
.complete-achievement-row { display:flex; align-items:center; justify-content:center; text-align:left; gap:10px; }
.complete-achievement .medal { width:50px; height:56px; color:#777D80; flex:none; --medal-center:#F9F9F9; }
.complete-achievement-copy { min-width:0; }
.complete-achievement-label { font-size:11px; color:#60696E; font-weight:700; letter-spacing:.055em; }
.intro .complete-achievement p { font-size:13px; line-height:1.55; margin:4px 0 0; color:#263039; }
/* Future reward link: only insert after the author's illustration exists. */
.intro .complete-bonus { display:inline-flex; align-items:center; justify-content:center; width:auto; min-height:40px; margin:14px auto 0; padding:7px 16px; border:1px solid #C9CFD1; border-radius:4px; background:#FFF; color:#647177; font-size:13px; text-decoration:none; }
@media(max-width:350px){ #play #outcome:not([hidden]) {column-gap:6px} #play #endingBadge .ending-title {font-size:12px} #play #endingBadge .ending-title-line {padding:0 5px;gap:4px} #play #replay {padding:6px 8px;font-size:12px} }

/* Intro: one footer separator, shared width and deliberate breathing room. */
.intro .start-main, .intro .disclaimer { box-sizing:border-box; width:100%; max-width:380px; }
.intro .disclaimer { margin:20px auto 0; padding-top:20px; }

/* Heart placement: continuous speech, preserve only authored line breaks. */
#play #sceneParts .scenePart.heart-placement-line { text-wrap: wrap; word-break: normal; }

/* Discovered SECRET: separate row, outside the five ordinary ending slots. */
.secret-collection {display:flex;align-items:center;justify-content:center;gap:8px;margin:12px auto 0;color:#606365;font-size:12px;line-height:1.5;}
.secret-collection-icon {display:grid;place-items:center;width:26px;height:26px;background:#E9E9E9;border-radius:50%;flex:none;color:#777D80;}
.secret-collection-icon svg {width:16px;height:16px;}

/* Mobile free-input row: keep input, submit and cancel on one line. */
@media (max-width:530px) {
  #freeInputRow:not([hidden]) { display:grid; grid-template-columns:minmax(0,1fr) auto auto; }
  #freeInputRow #sweetname { width:100%; min-width:0; }
  #freeInputRow #give, #freeInputRow #cancel { white-space:nowrap; }
}
