.reading-page-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 52px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.dialog-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.dialog-header-actions { display: flex; align-items: center; gap: 18px; }
.new-reading-button { min-height: 38px; padding-inline: 16px; }

.text-link {
  color: var(--muted);
  font: 12px var(--serif);
  text-decoration: none;
  letter-spacing: .08em;
}
.text-link:hover { color: var(--jade-dark); }

.dialog-stage {
  width: min(920px, 100%);
  margin: clamp(34px, 6vh, 68px) auto;
  background: rgba(255, 255, 252, .56);
  border: 1px solid var(--line);
  box-shadow: 0 26px 80px rgba(36, 43, 39, .07);
  backdrop-filter: blur(10px);
}

.dialog-titlebar {
  min-height: 104px;
  padding: 25px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.dialog-titlebar .eyebrow { margin-bottom: 6px; }
.dialog-titlebar h1 { margin: 0; font: 500 26px var(--serif); letter-spacing: .1em; }
.dialog-titlebar > p { margin: 0; color: var(--muted); font-size: 10px; text-align: right; }

.dialog-cast { margin: 0 30px; background: rgba(243, 240, 232, .48); }
.dialog-cast[hidden] { display: none; }
.dialog-messages { padding: 30px; display: grid; gap: 24px; }
.dialog-row { display: flex; align-items: flex-start; gap: 12px; opacity: 1; transform: none; transition: opacity .35s ease, transform .35s ease; }
.dialog-row:not(.reveal).ai-row { opacity: 0; transform: translateY(8px); }
.user-row { justify-content: flex-end; }
.dialog-bubble { max-width: 82%; padding: 18px 21px; border: 1px solid var(--line); }
.user-bubble { color: #f5f3ec; background: var(--jade-dark); border-color: var(--jade-dark); border-radius: 14px 14px 2px 14px; }
.ai-bubble { flex: 1; max-width: calc(100% - 46px); background: rgba(255, 255, 252, .68); border-radius: 2px 14px 14px 14px; }
.ai-avatar { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--jade-dark); border: 1px solid rgba(70, 103, 95, .38); border-radius: 50%; font: 15px var(--serif); }
.bubble-label { margin: 0 0 8px; opacity: .72; font: 9px var(--sans); letter-spacing: .16em; text-transform: uppercase; }
.bubble-content { margin: 0; white-space: pre-wrap; font: 14px/1.9 var(--serif); }
.reading-bubble { padding: 26px; }
.reading-bubble .reading-title { font-size: 23px; }
.pending-reveal { opacity: 0; transform: translateY(8px); }
.reading-block { transition: opacity .35s ease, transform .35s ease; }

.thinking-panel {
  margin: 0 30px 30px;
  padding: 25px 26px;
  border: 1px solid rgba(70, 103, 95, .22);
  background: linear-gradient(135deg, rgba(70, 103, 95, .065), rgba(255,255,255,.2));
}
.thinking-panel[hidden] { display: none; }
.thinking-panel > header { display: flex; align-items: center; gap: 13px; }
.thinking-panel header > div { display: grid; gap: 4px; }
.thinking-panel strong { font: 500 15px var(--serif); letter-spacing: .06em; }
.thinking-panel small { color: var(--muted); font-size: 10px; }
.thinking-seal { width: 35px; height: 35px; display: grid; place-items: center; color: var(--jade-dark); border: 1px solid var(--jade); font: 15px var(--serif); }
.thinking-pulse { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--jade); box-shadow: 0 0 0 0 rgba(70,103,95,.38); animation: thinkingPulse 1.7s ease-out infinite; }
@keyframes thinkingPulse { 70% { box-shadow: 0 0 0 9px rgba(70,103,95,0); } 100% { box-shadow: 0 0 0 0 rgba(70,103,95,0); } }

.thinking-steps { margin: 23px 0 18px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; }
.thinking-steps li { position: relative; padding: 22px 10px 0 0; color: #a0a39e; font: 10px/1.5 var(--serif); transition: color .25s; }
.thinking-steps li::before { content: ""; position: absolute; top: 5px; left: 5px; right: 0; height: 1px; background: var(--line); }
.thinking-steps li:last-child::before { display: none; }
.thinking-steps li span { position: absolute; top: 0; left: 0; z-index: 1; width: 11px; height: 11px; border: 1px solid #b8bbb6; border-radius: 50%; background: var(--paper); }
.thinking-steps li.active, .thinking-steps li.done { color: var(--jade-dark); }
.thinking-steps li.active span { border-color: var(--jade); background: var(--jade); box-shadow: 0 0 0 4px rgba(70,103,95,.12); }
.thinking-steps li.done span { border-color: var(--jade); background: var(--jade); }
.thinking-steps li.done span::after { content: ""; position: absolute; width: 4px; height: 2px; top: 3px; left: 2px; border-left: 1px solid white; border-bottom: 1px solid white; transform: rotate(-45deg); }
.thinking-detail { min-height: 22px; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font: 12px/1.7 var(--serif); transition: opacity .2s; }
.thinking-detail.detail-in { animation: detailIn .35s ease; }
@keyframes detailIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.dialog-composer { margin: 0 30px 30px; padding: 20px 22px 16px; border: 1px solid rgba(70, 103, 95, .28); background: rgba(255,255,252,.72); }
.dialog-composer[hidden] { display: none; }
.dialog-composer label { color: var(--jade-dark); font: 500 12px var(--serif); letter-spacing: .1em; }
.dialog-composer textarea { width: 100%; min-height: 90px; margin: 10px 0 12px; padding: 0; resize: vertical; border: 0; background: transparent; font: 14px/1.8 var(--serif); }
.dialog-composer textarea:focus { outline: 0; }
.dialog-composer footer { padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); }
.dialog-composer footer span { color: var(--muted); font-size: 10px; }

#reading-share-actions { margin: 0 30px 22px; padding-bottom: 4px; }
.reading-error { margin: 0 30px 30px; padding: 28px; text-align: center; border: 1px solid rgba(138,81,71,.25); background: rgba(138,81,71,.04); }
.reading-error[hidden] { display: none; }
.reading-error strong { font: 500 17px var(--serif); }
.reading-error p { color: var(--muted); font: 13px/1.8 var(--serif); }
.dialog-footer { min-height: 64px; padding: 20px 0; color: var(--muted); border-top: 1px solid var(--line); text-align: center; font-size: 10px; }

@media (max-width: 680px) {
  .reading-page-shell { padding: 0 12px; }
  .dialog-header { min-height: 72px; }
  .dialog-header-actions { gap: 10px; }
  .dialog-header-actions .text-link { display: none; }
  .new-reading-button { min-height: 36px; padding-inline: 13px; }
  .dialog-stage { margin: 20px auto; }
  .dialog-titlebar { min-height: 90px; padding: 20px 18px; align-items: flex-start; flex-direction: column; gap: 8px; }
  .dialog-titlebar > p { text-align: left; }
  .dialog-cast { margin: 0 14px; }
  .dialog-messages { padding: 22px 14px; }
  .dialog-bubble { max-width: 92%; padding: 16px; }
  .ai-bubble { max-width: calc(100% - 42px); }
  .reading-bubble { padding: 19px 16px; }
  .thinking-panel, .dialog-composer, #reading-share-actions, .reading-error { margin-right: 14px; margin-left: 14px; }
  .thinking-panel { padding: 20px 17px; }
  .thinking-steps { grid-template-columns: 1fr; gap: 8px; }
  .thinking-steps li { min-height: 24px; padding: 2px 0 2px 27px; }
  .thinking-steps li::before { top: 11px; right: auto; bottom: -9px; left: 5px; width: 1px; height: auto; }
  .thinking-steps li span { top: 4px; }
  .dialog-composer footer { align-items: stretch; flex-direction: column; }
  .dialog-composer .primary-button { width: 100%; }
}
