/* Reading explanations live in their own dialog, inside the portrait game bounds. */
#game-root dialog.reading-guide-dialog[data-role="reading-guide-dialog"] {
  position: fixed;
  inset: auto;
  left: var(--reading-dialog-x, 50%);
  top: var(--reading-dialog-y, 50%);
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  width: var(--reading-dialog-width, min(424px, calc(100vw - 24px)));
  min-width: 0;
  max-width: var(--reading-dialog-width, calc(100vw - 24px));
  height: min(690px, var(--reading-dialog-height, calc(100dvh - 32px)));
  max-height: var(--reading-dialog-height, calc(100dvh - 32px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid #b6a16d;
  border-radius: 13px;
  background: linear-gradient(135deg, #f0f0df, #d7e1ce) !important;
  color: #244f4d !important;
  box-shadow: 0 12px 45px #082b3466, inset 0 0 0 2px #f9f2d580;
  font-family: KaiTi, STKaiti, "Noto Serif SC", "Songti SC", SimSun, serif;
  text-align: left;
}

#game-root .reading-guide-dialog::backdrop {
  background: #102e358f;
}

#game-root .reading-guide-dialog::before,
#game-root .reading-guide-dialog::after {
  content: none;
}

#game-root [data-role="reading-guide-content"] {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}

#game-root .reading-guide-dialog [hidden] {
  display: none !important;
}

#game-root .reading-guide__heading {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid #c5af79;
  background: linear-gradient(110deg, #1b484d, #2c615d) !important;
  color: #f3e5b8 !important;
}

#game-root dialog.reading-guide-dialog .reading-guide__heading h2 {
  margin: 0;
  color: #f3e5b8 !important;
  -webkit-text-fill-color: #f3e5b8 !important;
  text-shadow: none !important;
  font-size: 25px !important;
  font-weight: normal;
  line-height: 1.3;
  letter-spacing: 4px;
}

#game-root .reading-guide__close {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid #c4b078;
  border-radius: 7px;
  background: #31615c !important;
  color: #f3e5b8 !important;
  font: inherit;
  font-size: 25px;
  line-height: 1;
}

#game-root .reading-guide__heading p {
  margin: 5px 0 0;
  color: #d3ddc8;
  font-size: 12px;
  line-height: 1.4;
}

#game-root .reading-guide__claim-row strong {
  color: #89622c;
  font-weight: normal;
}

#game-root .reading-guide__status {
  flex-shrink: 0;
  box-sizing: border-box;
  height: 44px;
  margin: 0;
  padding: 10px 18px;
  overflow-y: auto;
  color: #386e56;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
}

#game-root .reading-guide__status.is-error {
  color: #a34b3d;
}

#game-root .reading-guide__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #9dad94 transparent;
  padding: 12px 14px 4px;
}

#game-root .reading-guide__entry {
  margin: 0 0 9px;
  overflow: hidden;
  border: 1px solid #a7b59a;
  border-radius: 7px;
  background: #f4f3e4b3;
}

#game-root .reading-guide__entry.is-expanded {
  border-color: #b0a16e;
  background: #f6f4e6;
}

#game-root .reading-guide__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 51px;
  box-sizing: border-box;
  margin: 0;
  padding: 12px 13px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(135deg, #dcd9cca3, #bcbcaf8f) !important;
  color: #245452;
  box-shadow: none;
  font: inherit;
  text-align: left;
}

#game-root .reading-guide__entry-title {
  flex: 1;
  min-width: 0;
  font-size: 20px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#game-root .reading-guide__entry-state {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
  color: #7e7d5c;
  font-size: 14px;
}

#game-root .reading-guide__entry-state i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c85843;
  box-shadow: 0 0 0 2px #f4f3e4;
}

#game-root .reading-guide__entry.is-read .reading-guide__entry-state {
  color: #81927c;
}

#game-root .reading-guide__chevron {
  align-self: center;
  color: #6b8572;
  font-size: 20px;
  line-height: 1;
}

#game-root .reading-guide__entry.is-expanded .reading-guide__chevron {
  transform: rotate(180deg);
}

#game-root .reading-guide__body {
  padding: 0 13px 13px;
}

#game-root .reading-guide__explanation {
  padding-top: 9px;
  border-top: 1px solid #c5ceb8;
}

#game-root .reading-guide__explanation p {
  margin: 0 0 9px;
  color: #496151;
  font-size: 18px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

#game-root .reading-guide__claim-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  color: #7b8166;
  font-size: 14px;
  line-height: 1.6;
}

#game-root .reading-guide__claim,
#game-root .reading-guide__retry {
  min-height: 42px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 17px;
  border: 1px solid #b39c60;
  border-radius: 6px;
  background: linear-gradient(125deg, #2b6661, #1c4b4d) !important;
  color: #f6e6b6 !important;
  box-shadow: inset 0 0 0 2px #c8b77838;
  font: inherit;
  font-size: 18px;
  line-height: 1.4;
}

#game-root .reading-guide__claim:disabled {
  opacity: .65;
}

#game-root .reading-guide-dialog button {
  cursor: pointer;
  touch-action: manipulation;
}

#game-root .reading-guide-dialog button:focus-visible {
  outline: 2px solid #9c7c34;
  outline-offset: -3px;
}

#game-root .reading-guide__empty {
  margin: 22px 0;
  color: #6a7b66;
  font-size: 15px;
  line-height: 1.8;
  text-align: center;
}

#game-root .reading-guide__retry {
  display: block;
  margin: 12px auto;
}

@media (max-height: 560px) {
  #game-root .reading-guide__heading { padding-block: 9px; }
}
