/* Keep writing out of the card layout; only a quiet theme line stays on the table. */
body[data-page] .reading-intention {
  width: min(600px, 100%);
  min-width: 0;
  margin: 0 auto;
  text-align: center;
  box-sizing: border-box;
}

body[data-page] .reading-intention-trigger {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 4px 6px;
  overflow: hidden;
  border: 0;
  border-radius: 3px;
  background: transparent;
  box-shadow: none;
  color: rgba(235, 216, 175, .72);
  font: 400 12px / 20px "Songti SC", "STSong", serif;
  letter-spacing: .02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

body[data-page] .reading-intention-trigger:hover {
  color: #f6e7c3;
}

body[data-page="draw"] .spread-section > .section-heading {
  position: relative;
}

body[data-page="draw"] .section-heading > .reading-intention {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Desktop uses the slot gap; phones place the entry just below the controls. */
body[data-page="theme-draw"] .theme-oracle-stage > .reading-intention {
  position: absolute;
  top: var(--intention-top, 60%);
  left: 50%;
  z-index: 25;
  width: min(600px, calc(100% - 32px));
  transform: translateX(-50%);
}

body[data-page="theme-draw"] .reading-intention-trigger {
  color: #e5cb8e;
  text-shadow: 0 1px 5px #020806;
}

@media (max-width: 680px) {
  body[data-page="theme-draw"] .theme-oracle-stage > .reading-intention {
    margin-top: clamp(0px, calc((100svh - 590px) * .12), 8px);
  }

  body[data-page="theme-draw"] .reading-intention-trigger {
    min-height: 20px;
    padding-block: 0;
  }
}

body[data-page="draw"].draw-result-reference-scale .reading-intention,
body[data-page="theme-result"] .reading-intention {
  position: relative;
  width: min(720px, calc(100% - 24px));
  margin: 0 auto 6px;
}

body[data-page="draw"].draw-result-reference-scale .reading-intention.has-intention .reading-intention-trigger,
body[data-page="theme-result"] .reading-intention.has-intention .reading-intention-trigger {
  overflow: visible;
  color: #e5cb8e;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}

.intention-editor {
  box-sizing: border-box;
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 22px;
  overflow-y: auto;
  border: 1px solid rgba(224, 192, 119, .55);
  border-radius: 12px;
  background: #07130f;
  color: #f6e7c3;
  box-shadow: 0 18px 80px rgba(0, 0, 0, .6);
}

.intention-editor::backdrop {
  background: rgba(0, 5, 3, .7);
}

.intention-editor label {
  display: block;
  margin-bottom: 12px;
  color: #e5cb8e;
  font: 400 17px / 1.5 "Songti SC", "STSong", serif;
}

body[data-page] .intention-editor textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 100px;
  max-height: 35dvh;
  margin: 0;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid rgba(224, 192, 119, .32);
  border-radius: 6px;
  background: rgba(0, 5, 3, .5);
  color: #f6e7c3;
  font: 400 16px / 1.6 "Songti SC", "STSong", serif;
}

.intention-editor textarea::placeholder {
  color: rgba(235, 216, 175, .43);
}

.intention-editor textarea:focus-visible {
  outline: 2px solid #e5cb8e;
  outline-offset: 2px;
}

.intention-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

body[data-page] .intention-editor-actions button {
  min-width: 72px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid rgba(224, 192, 119, .35);
  border-radius: 6px;
  background: transparent;
  color: #e5cb8e;
  font-size: 14px;
  cursor: pointer;
}

body[data-page] .intention-editor-actions button[type="submit"] {
  background: #e5cb8e;
  color: #152219;
}

@media (max-width: 899px) {
  body[data-page="draw"] .section-heading > .reading-intention {
    top: 52px;
    left: 50%;
    width: calc(100% - 176px);
    transform: translateX(-50%);
    text-align: center;
  }
}


.intention-editor-error:not([hidden]) {
  margin: 12px 0 0;
  color: #f1c19b;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 680px) and (max-height: 640px) {
  body[data-page="theme-draw"] .reading-intention-trigger {
    min-height: 18px;
    line-height: 18px;
  }
}
