/* ══════════════════════════════════════════════
   READER WINDOW
   ══════════════════════════════════════════════ */
.reader-window {
  position: fixed; display: flex; flex-direction: column;
  width: 580px;
  max-width: calc(100vw - 24px);
  height: 375px;
  max-height: calc(100vh - 24px);
  min-width: 320px;
  min-height: 220px;
  border: none;
  outline: 1px solid var(--reader-outline);
  box-shadow:
    0 0 0 1px rgba(160,210,230,0.08),
    0 0 18px rgba(166, 204, 236, 0.08),
    0 12px 60px rgba(0,0,0,0.85),
    0 2px 16px rgba(0,0,0,0.6),
    inset 0 0 80px rgba(0,10,20,0.3);
  z-index: 110; overflow: hidden;
}

.reader-window::before,
.reader-window::after {
  content: '';
  position: absolute;
  width: var(--corner-size);
  height: var(--corner-size);
  pointer-events: none;
  z-index: 10;
}

.reader-window::before {
  top: 0;
  left: 0;
  background:
    linear-gradient(to right, rgba(242, 220, 144, 0.48) 0%, rgba(242, 220, 144, 0.14) 60%, transparent 100%) top / 100% 1px no-repeat,
    linear-gradient(to bottom, rgba(150, 196, 236, 0.48) 0%, rgba(150, 196, 236, 0.14) 60%, transparent 100%) left / 1px 100% no-repeat;
}

.reader-window::after {
  right: 0;
  bottom: 0;
  background:
    linear-gradient(to left, rgba(242, 220, 144, 0.48) 0%, rgba(242, 220, 144, 0.14) 60%, transparent 100%) bottom / 100% 1px no-repeat,
    linear-gradient(to top, rgba(150, 196, 236, 0.48) 0%, rgba(150, 196, 236, 0.14) 60%, transparent 100%) right / 1px 100% no-repeat;
}

.reader-window ::selection {
  background: rgba(180, 160, 210, 0.3);
  color: rgba(246, 242, 252, 0.98);
  text-shadow: none;
}

.reader-window.reader-log ::selection {
  background: rgba(160, 210, 240, 0.28);
  color: rgba(238, 248, 255, 0.98);
}

.reader-window.reader-signal-window ::selection {
  background: rgba(132, 206, 192, 0.28);
  color: rgba(236, 250, 246, 0.98);
}

@media (max-width: 604px) {
  .reader-window {
    width: calc(100vw - 24px);
  }
}

@media (max-width: 768px) {
  .reader-window {
    max-width: calc(100vw - 24px);
    height: auto;
    max-height: calc(100vh - 24px);
    min-width: 320px;
    min-height: 220px;
  }

  .reader-header {
    padding: 16px 18px 0;
  }

  .reader-corner-glyph {
    top: 12px;
    right: 18px;
  }

  .reader-divider {
    margin: 0 18px;
  }

  .reader-body {
    padding: 18px 32px 18px 18px;
  }

  .reader-body::before {
    right: 8px;
    top: 20px;
  }
}

.reader-titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 12px;
  border-bottom: 1px solid var(--reader-border);
  font-size: 7px; letter-spacing: 0.22em;
  color: rgba(220,218,228,0.38);
  flex-shrink: 0;
  cursor: var(--cursor-grab); user-select: none;
  font-family: var(--font-mono); line-height: 1;
  text-shadow: var(--glow-violet-medium);
}

.reader-close {
  cursor: var(--cursor-pointer);
  color: rgba(236, 214, 138, 0.38);
  font-size: 9px;
  background: none; border: none;
  font-family: var(--font-mono); padding: 0;
  transition: color 0.2s, text-shadow 0.2s;
}

.reader-close:hover {
  color: rgba(248, 236, 184, 0.96);
  text-shadow:
    0 0 6px rgba(244, 230, 170, 0.96),
    0 0 18px rgba(224, 206, 126, 0.5);
}

.reader-close:focus,
.reader-close:focus-visible {
  outline: none;
  box-shadow: none;
  color: rgba(248, 236, 184, 0.96);
  text-shadow:
    0 0 4px rgba(244, 230, 170, 0.58),
    0 0 12px rgba(224, 206, 126, 0.24);
}

/* ── Header area ── */
.reader-header {
  padding: 20px 28px 0;
  flex-shrink: 0;
  position: relative;
}

/* corner glyph — tag symbol top-right */
.reader-corner-glyph {
  position: absolute;
  top: 16px; right: 28px;
  font-size: 18px;
  color: rgba(210,208,222,0.22);
  font-family: var(--font-serif);
  line-height: 1;
  pointer-events: none;
  text-shadow:
    0 0 10px rgba(210,208,222,0.3),
    0 0 24px rgba(190,188,208,0.14);
}

/* thin rule above title */
.reader-title-rule-top {
  height: 1px;
  background: linear-gradient(to right, rgba(160,130,220,0.3), rgba(140,110,210,0.07) 70%, transparent);
  margin-bottom: 10px;
}

.reader-title {
  font-size: 10px;
  color: var(--reader-title);
  letter-spacing: 0.18em;
  margin-bottom: 8px;
  text-shadow: var(--glow-violet-high);
  font-family: var(--font-mono);
  text-transform: uppercase;
  line-height: 1.5;
}

.reader-window.reader-log .reader-title {
  color: rgba(225, 155, 200, 0.92);
  text-shadow:
    0 0 5px rgba(215,130,185,0.9),
    0 0 14px rgba(195,110,165,0.45),
    0 0 28px rgba(175,90,145,0.2);
}

.reader-window.reader-log .reader-title-rule-top {
  background: linear-gradient(to right, rgba(225, 155, 200, 0.34), rgba(195, 110, 165, 0.08) 70%, transparent);
}

.reader-window.reader-log .reader-title-rule-bottom {
  background: linear-gradient(to right, rgba(225, 155, 200, 0.2), rgba(195, 110, 165, 0.05) 70%, transparent);
}

.reader-window.reader-signal-window .reader-title {
  color: rgba(180, 225, 215, 0.88);
  text-shadow:
    0 0 5px rgba(120, 195, 190, 0.9),
    0 0 14px rgba(100, 175, 170, 0.45),
    0 0 28px rgba(80, 155, 150, 0.2);
}

.reader-window.reader-signal-window .reader-title-rule-top {
  background: linear-gradient(to right, rgba(132, 206, 192, 0.34), rgba(96, 166, 156, 0.08) 70%, transparent);
}

.reader-window.reader-signal-window .reader-title-rule-bottom {
  background: linear-gradient(to right, rgba(132, 206, 192, 0.2), rgba(96, 166, 156, 0.05) 70%, transparent);
}

/* thin rule below title */
.reader-title-rule-bottom {
  height: 1px;
  background: linear-gradient(to right, rgba(160,130,220,0.18), rgba(140,110,210,0.04) 70%, transparent);
  margin-top: 10px;
  margin-bottom: 10px;
}

/* ── Meta row ── */
.reader-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  flex-wrap: wrap;
  gap: 6px;
}

.reader-date {
  font-size: 8px;
  color: rgba(220,218,225,0.42);
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
  text-shadow: var(--glow-violet-low);
}

.reader-tags {
  display: flex; gap: 5px; flex-wrap: wrap;
  align-items: center;
}

.reader-tag {
  font-size: 8px;
  font-family: var(--font-mono);
  color: rgba(220,218,228,0.5);
  border: 1px solid rgba(210,208,222,0.16);
  padding: 1px 6px;
  letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 4px;
  text-shadow: var(--glow-violet-low);
}

.reader-tag-glyph {
  font-size: 10px;
  opacity: 0.6;
}

.reader-signal {
  font-size: 8px;
  font-family: var(--font-mono);
  color: rgba(215,213,225,0.38);
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow: var(--glow-violet-low);
}

.reader-signal-bar {
  display: inline-block;
  letter-spacing: -1px;
}

/* ── Divider — draws itself on open ── */
.reader-divider {
  height: 1px;
  margin: 0 28px;
  flex-shrink: 0;
  background: linear-gradient(to right, rgba(150,120,220,0.25), rgba(130,100,210,0.06) 80%, transparent);
  position: relative;
  overflow: hidden;
}

.reader-divider::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(to right, transparent, rgba(190,160,255,0.7), transparent);
  animation: divider-sweep 1.2s ease-out forwards;
}

/* ── Body ── */
.reader-body {
  flex: 1; overflow-y: auto;
  padding: 22px 52px 22px 28px;
  color: var(--reader-text);
  line-height: 1.2; font-size: 11px;
  font-family: var(--font-mono);
  text-shadow: var(--glow-violet-high);
  scrollbar-width: thin;
  scrollbar-color: rgba(160,155,185,0.1) transparent;
  position: relative;
}

.reader-body img { 
  max-width: 100%; 
  margin: 1em 0; 
  opacity: 0.85; 
}

/* faint margin annotation — coordinate ref */
.reader-body::before {
  content: attr(data-coord);
  position: absolute;
  top: 26px; right: 14px;
  font-family: var(--font-mono);
  font-size: 7px;
  color: rgba(200,198,215,0.1);
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  pointer-events: none;
  user-select: none;
}

/* typewriter paragraph reveal */
.reader-body p {
  margin-bottom: 1.5em;
  opacity: 0;
  animation: reader-appear 0.5s ease forwards;
}

.reader-comments {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid rgba(160, 210, 240, 0.12);
}

.reader-comments-title {
  margin-bottom: 14px;
  font-size: 8px;
  letter-spacing: 0.14em;
  color: rgba(214, 166, 206, 0.72);
  text-shadow:
    0 0 5px rgba(215,130,185,0.82),
    0 0 14px rgba(195,110,165,0.34);
}

.reader-comment {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 10px 4px 10px 2px;
  border-radius: 999px;
  border: none;
  background: transparent;
  box-shadow: none;
  position: relative;
}

.reader-comment.pko-01 {
  box-shadow: none;
}

.reader-comment.pko-02 {
  box-shadow: none;
}

.reader-comment + .reader-comment {
  margin-top: 20px;
}

.reader-comment + .reader-comment::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 62px;
  right: 8px;
  height: 1px;
  background: linear-gradient(
    to right,
    rgba(225, 155, 200, 0.2),
    rgba(195, 110, 165, 0.08) 48%,
    rgba(195, 110, 165, 0.02) 100%
  );
}

.reader-comment-badge {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background: transparent;
}

.reader-comment-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0.92;
}

.reader-comment-badge.pko-01 {
  color: rgba(244, 216, 136, 0.96);
  box-shadow:
    0 0 12px rgba(236, 208, 128, 0.38);
}

.reader-comment-badge.pko-02 {
  color: rgba(182, 224, 244, 0.92);
  box-shadow:
    0 0 12px rgba(164, 208, 236, 0.3);
}

.reader-comment-badge-core {
  position: relative;
  z-index: 1;
  font-size: 19px;
  line-height: 1;
}

.reader-comment-content {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 1px;
}

.reader-comment-author {
  font-size: 8px;
  letter-spacing: 0.14em;
  margin-bottom: 5px;
  line-height: 1;
}

.reader-comment.pko-01 .reader-comment-author,
.reader-comment.pko-01 .reader-comment-message {
  color: rgba(244, 216, 136, 0.94);
  text-shadow:
    0 0 6px rgba(236, 208, 128, 0.54),
    0 0 16px rgba(236, 208, 128, 0.18);
}

.reader-comment.pko-02 .reader-comment-author,
.reader-comment.pko-02 .reader-comment-message {
  color: rgba(190, 228, 244, 0.92);
  text-shadow:
    0 0 6px rgba(164, 208, 236, 0.42),
    0 0 14px rgba(164, 208, 236, 0.16);
}

.reader-comment-message {
  margin: 0;
  opacity: 1;
  animation: none;
  line-height: 1.42;
}

@media (max-width: 640px) {
  .reader-comment {
    align-items: flex-start;
    border-radius: 24px;
  }
}

/* signal reader meta */
.reader-signal-meta {
  font-size: 8px;
  font-family: var(--font-mono);
  color: rgba(220,218,228,0.4);
  letter-spacing: 0.12em;
  padding-bottom: 14px;
  text-shadow: var(--glow-violet-low);
}
