/* Reader-specific styles. The shared shell (header + bento) lives in
   /static/css/styles.css; this mirrors writer.css for cohesion. */

.reader-page { overscroll-behavior-y: contain; }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: calc(100dvh - var(--header-h, 60px));
}
.sidebar {
  border-right: 1px solid var(--bs-border-color);
  background: #fff;
  overflow-y: auto;
  padding: 1rem;
}
.main {
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  background: var(--app-bg, #f7f7f9);
}

.file-item { cursor: pointer; }
.file-item.active {
  background: #e9f2ff;
  font-weight: 600;
}

.reader-dialog {
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-left: 4px solid var(--bs-primary);
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.dialog-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #1a2332;
}
.hanzi-line {
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;          /* let .line-translation drop to a new row */
  align-items: flex-start;
  gap: .5rem;
}
.line-hanzi {
  font-size: 1.25rem;
  font-weight: 400;
  color: #222;
  flex: 1 1 auto;
  min-width: 0;
  font-family: 'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans CJK SC','Source Han Sans SC',sans-serif;
}

/* Inline English translation rendered under each Chinese line by the
   "Translate all" button. Cached per-reading in localStorage. The
   `flex-basis: 100%` + flex-wrap on the parent puts this on its own row
   below the play button + hanzi block, indented to line up under the
   first character of the hanzi (i.e. past the play button + gap). */
.line-translation {
  flex: 1 0 100%;
  margin-top: .15rem;
  padding-left: 2.75rem;
  color: var(--bs-secondary-color);
  font-size: .95rem;
  line-height: 1.45;
  font-style: italic;
}
/* Toggled by the header's English switch. Hides every per-line translation
   without removing them from storage — toggling back is instant. */
body.reader-hide-english .line-translation { display: none; }

.reader-translate-status {
  margin-top: .5rem;
  padding: .4rem .55rem;
  background: #eef4ff;
  border: 1px solid #d6e3ff;
  border-radius: .35rem;
}

.reader-empty {
  text-align: center;
  color: var(--bs-secondary-color);
  padding: 3rem 1rem;
}
.reader-empty .reader-empty-mark {
  font-size: 4rem;
  line-height: 1;
  color: var(--bs-primary);
  font-family: 'PingFang SC','Hiragino Sans GB','Microsoft YaHei','Noto Sans CJK SC','Source Han Sans SC',sans-serif;
  font-weight: 700;
}

.dialog-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.dialog-controls .form-control,
.dialog-controls .form-select { width: auto; }

textarea#content-input { font-family: inherit; min-height: 120px; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 1040;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 20px rgba(0,0,0,.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1039;
    display: none;
  }
  .sidebar-backdrop.show { display: block; }
}
