/* ── Scene background transitions ── */
.scene-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #05080F 0%, #0B1422 42%, #0E1726 72%, #05070C 100%);
}

.scene-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity var(--duration-scene) var(--ease-out);
}

/* ── Story overlay layers (§1) ── */
.story-overlay {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    var(--overlay-story-2),
    var(--overlay-story-1);
  pointer-events: none;
}

/* ─ Authority Chapter/Section opening (§14.1 / Android TASK-20260723-002) ── */
.authority-chapter-opening {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: card-fade-in var(--duration-slow) var(--ease-out) forwards;
}

.authority-opening-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(135deg, #05080F 0%, #0B1422 42%, #0E1726 72%, #05070C 100%),
    radial-gradient(ellipse at 50% 50%, rgba(14, 23, 38, 0.18) 0%, transparent 58%),
    linear-gradient(to bottom, rgba(9, 14, 24, 0.22), rgba(9, 14, 24, 0.02) 35%, rgba(9, 14, 24, 0.48));
}

.authority-opening-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 330px;
  padding: 0 42px;
  gap: 18px;
}

.authority-opening-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(215, 190, 134, 0.44), transparent);
  margin-top: -4px;
  margin-bottom: 4px;
}

.authority-opening-eyebrow {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(215, 190, 134, 0.82);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-opening-name {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 0.18em;
  color: rgba(247, 249, 252, 0.72);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-opening-title {
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1.34;
  letter-spacing: 0.02em;
  color: var(--snow-94);
  text-align: center;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-opening-desc {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.92;
  color: rgba(244, 241, 234, 0.78);
  text-align: center;
  max-width: 310px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-opening-tap {
  position: absolute;
  bottom: 90px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: rgba(247, 249, 252, 0.82);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
  z-index: 1;
}

/* ── Authority Chapter/Section Clear card (§14.2 / Android TASK-20260723-002) ── */
.authority-section-opening {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  cursor: pointer;
  animation: card-fade-in var(--duration-slow) var(--ease-out) forwards;
}

.authority-section-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(to bottom, rgba(5, 8, 15, 0.04) 0%, rgba(5, 8, 15, 0.12) 40%, rgba(9, 16, 28, 0.88) 100%),
    linear-gradient(to right, rgba(5, 8, 15, 0.24), transparent 22%, transparent 72%, rgba(5, 8, 15, 0.28));
  pointer-events: none;
}

.authority-section-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 270px;
  padding: 30px 56px 90px;
  background:
    radial-gradient(ellipse at 68% 24%, rgba(247, 249, 252, 0.11), transparent 46%),
    linear-gradient(to bottom, rgba(24, 36, 55, 0.42), rgba(12, 22, 37, 0.84) 68%, rgba(9, 16, 28, 0.96));
  box-shadow: 0 -24px 52px rgba(0, 0, 0, 0.24);
}

.authority-section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 22px;
  color: rgba(215, 190, 134, 0.96);
  font-size: 13px;
  line-height: 1;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.56);
}

.authority-section-label span {
  width: 22px;
  height: 1px;
  background: linear-gradient(to right, rgba(215, 190, 134, 0.18), rgba(215, 190, 134, 0.82));
}

.authority-section-label b {
  font-weight: 400;
}

.authority-section-index {
  margin-bottom: 10px;
  color: rgba(215, 190, 134, 0.88);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.4;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.56);
}

.authority-section-title {
  color: rgba(247, 249, 252, 0.96);
  font-family: var(--font-serif);
  font-size: 29px;
  line-height: 1.34;
  letter-spacing: 0.02em;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.58);
}

.authority-section-desc {
  margin-top: 18px;
  color: rgba(247, 249, 252, 0.88);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.72;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.58);
}

.authority-section-line {
  height: 1px;
  margin-top: 22px;
  background: linear-gradient(to right, rgba(215, 190, 134, 0.22), rgba(247, 249, 252, 0.08), transparent);
}

.authority-chapter-ending {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: card-fade-in var(--duration-slow) var(--ease-out) forwards;
}

@keyframes card-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.authority-ending-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(135deg, #05080F 0%, #0A1220 42%, #0E1726 72%, #05070C 100%),
    radial-gradient(ellipse at 50% 32%, rgba(215, 190, 134, 0.07) 0%, transparent 42%),
    radial-gradient(ellipse at 50% 78%, rgba(30, 58, 138, 0.10) 0%, transparent 48%);
}

.authority-ending-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 330px;
  padding: 0 42px;
  gap: 14px;
}

.authority-clear-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(215, 190, 134, 0.54);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-clear-divider {
  width: 188px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(215, 190, 134, 0.28), transparent);
}

.authority-clear-name {
  font-family: var(--font-serif);
  font-size: 14px;
  color: rgba(247, 249, 252, 0.46);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-clear-title {
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 1.42;
  color: rgba(247, 249, 252, 0.62);
  text-align: center;
  max-width: 310px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-clear-desc {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.8;
  color: rgba(244, 241, 234, 0.54);
  text-align: center;
  max-width: 310px;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-ending-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
}

.authority-ending-continue {
  font-size: 14px;
  letter-spacing: 0.12em;
  color: rgba(247, 249, 252, 0.96);
  font-weight: 500;
  cursor: pointer;
  pointer-events: auto;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-ending-home {
  font-size: 14px;
  letter-spacing: 0.12em;
  color: rgba(247, 249, 252, 0.82);
  cursor: pointer;
  pointer-events: auto;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.64);
}

.authority-ending-continue:hover,
.authority-ending-home:hover {
  opacity: 0.8;
}

/* ── Replay complete ── */

.authority-replay-complete {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: card-fade-in var(--duration-slow) var(--ease-out) forwards;
}

.replay-complete-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(9, 16, 28, 0.88);
}

.replay-complete-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 36px;
}

.replay-complete-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(215, 190, 134, 0.72);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.42);
}

.replay-complete-divider {
  width: 48px;
  height: 1px;
  margin: 18px 0;
  background: linear-gradient(to right, transparent, rgba(215, 190, 134, 0.28), transparent);
}

.replay-complete-section {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.42;
  color: rgba(247, 249, 252, 0.88);
  text-align: center;
  max-width: 300px;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.58);
}

.replay-complete-chapter {
  margin-top: 10px;
  font-size: 13px;
  color: rgba(201, 209, 220, 0.45);
}

.replay-complete-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: max(36px, env(safe-area-inset-bottom, 36px));
}

.replay-complete-back {
  font-size: 14px;
  letter-spacing: 0.08em;
  color: rgba(215, 190, 134, 0.75);
  cursor: pointer;
  pointer-events: auto;
}

.replay-complete-back:hover {
  opacity: 0.8;
}

.replay-complete-hint {
  font-size: 11px;
  color: rgba(201, 209, 220, 0.38);
}

/* ── Ending page (§18.1) ── */
.ending-card-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 28px 82px;
  animation: card-fade-in var(--duration-slow) var(--ease-out) forwards;
}

.ending-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--deep-40), var(--deep-72));
}

.ending-card {
  position: relative;
  z-index: 1;
  backdrop-filter: blur(18px) saturate(0.92);
  -webkit-backdrop-filter: blur(18px) saturate(0.92);
  background:
    radial-gradient(ellipse at 70% 0%, var(--gold-16), transparent 38%),
    linear-gradient(to bottom, var(--deep-50), var(--deep-76));
  border: 1px solid var(--white-10);
  clip-path: var(--clip-cut-md);
  padding: 28px 24px 22px;
  box-shadow: 0 22px 54px var(--black-34);
}

.ending-card-tag {
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.ending-card-tag.true { color: #D7BE86; }
.ending-card-tag.good { color: #C9A85C; }
.ending-card-tag.normal { color: var(--ending-normal); }
.ending-card-tag.bad { color: var(--ending-bad); }

.ending-card-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--snow-94);
  text-shadow: 0 2px 20px var(--black-54);
}

.ending-card-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--snow-78);
  margin-top: var(--space-sm);
}

/* Status feedback — static inline note, NOT a button (§18.1) */
.ending-unlock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--parchment-70);
  width: fit-content;
  margin-top: 14px;
}

.ending-unlock-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-72);
  box-shadow: 0 0 8px var(--gold-18);
  flex-shrink: 0;
}

/* Primary action — only "返回主页" (§18.1) */
.ending-action-primary {
  margin-top: 22px;
  min-height: 38px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: #F7F9FC;
  background: linear-gradient(to right, var(--gold-20), var(--white-07));
  border: 1px solid var(--gold-26);
  clip-path: var(--clip-cut-sm);
  cursor: pointer;
  pointer-events: auto;
}

.ending-action-primary:hover {
  opacity: 0.85;
}

/* ── LINE Chat Layer (§20) ── */
.line-chat-container {
  position: absolute;
  top: 84px;
  left: 18px;
  right: 18px;
  bottom: 34px;
  padding: 18px;
  background: var(--glass-panel-bg);
  backdrop-filter: blur(16px) saturate(0.92);
  -webkit-backdrop-filter: blur(16px) saturate(0.92);
  clip-path: var(--clip-cut-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  z-index: 4;
}

.line-bubble {
  max-width: 86%;
  padding: 12px 14px;
  background: var(--white-08);
  clip-path: var(--clip-cut-sm);
  font-size: 14px;
  line-height: 1.7;
  color: var(--snow-92);
  align-self: flex-start;
}

.line-bubble.me {
  background: var(--gold-18);
  align-self: flex-end;
}

.line-timestamp {
  font-size: 12px;
  color: var(--snow-56);
  text-align: center;
}
