/* ==============================
   BASE
============================== */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #f6f6f6;
  overflow-y: auto;
  font-family: Arial, sans-serif;
  color: #111;
  line-height: 1.5;
}

/* ==============================
   TOP NAV
============================== */

.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 0 20px;
  background: #111;
  color: white;
  z-index: 1000;
}

.top-nav a {
  color: #ccc;
  margin: 0 10px;
  text-decoration: none;
}

.top-nav a.active {
  color: white;
  font-weight: bold;
  border-bottom: 2px solid white;
}

/* ==============================
   PAGE WRAPPER
============================== */

.page-content {
  padding-top: 50px;
  box-sizing: border-box;
  height: auto;
  min-height: calc(100vh - 50px);
  overflow: visible;
}

/* ==============================
   VIEWER CONTAINER
============================== */

.container {
  display: flex;
  height: calc(100vh - 50px);
  background: white;
  border-radius: 6px;
  align-items: stretch;
}

/* ==============================
   COLUMNS
============================== */

.column {
  padding: 10px;
  box-sizing: border-box;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.left {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.middle {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ccc;
  overflow: hidden;
}

.right {
  flex: 0 0 10%;
  overflow-y: auto;
}

/* ==============================
   RESIZERS
============================== */

.resizer {
  width: 6px;
  cursor: col-resize;
  background: #ccc;
  flex-shrink: 0;
}

.resizer:hover {
  background: #999;
}

/* ==============================
   TABLE AREA
============================== */

#table-container {
  flex: 1;
  overflow: auto;
  width: 100%;
}

.no-table-page {
    max-width: 32rem;
    margin: 4rem auto;
    padding: 2rem;
    text-align: center;
    color: #4b5563;
    background: #f8fafc;
    border: 1px solid #dbe3ea;
    border-radius: 0.5rem;
}

.no-table-page-title {
    margin-bottom: 0.75rem;
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 700;
}

.no-table-page p {
    margin: 0.4rem 0;
}

.grid-zoom-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: auto;
  transform-origin: top left;
}

#table-container.stack-mode {
  overflow: visible;
}

.result-grid {
  display: grid;
  width: max-content;
  gap: 1px;
  user-select: text;
  grid-auto-rows: minmax(2em, 1fr);
  border: 1px solid;
}

/* ==============================
   CELLS
============================== */

.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid #999;
  box-sizing: border-box;
  white-space: pre;
}

.cell-content {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  line-height: 0.9;
}

.cell-line {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0.9em;
  white-space: nowrap;
}

.cell-content--dense {
  font-size: 0.72em;
  line-height: 0.82;
}

.char.selected-char {
  background: #4da3ff !important;
  color: white;
}

.char.highlight {
  background: yellow;
}

/* ==============================
   IMAGE VIEWER
============================== */

.image-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

#openseadragon-viewer {
  width: 100%;
  height: 80vh;
  background: black;
}

/* ==============================
   STACK MODE
============================== */

.stack-page-block {
  margin-bottom: 40px;
  border-top: 2px solid #444;
  padding-top: 10px;
}

.stack-page-header {
  font-weight: bold;
  margin-bottom: 10px;
  background: #222;
  color: white;
  padding: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-separator {
  height: 2rem;
  border-top: 1px solid #bbb;
  margin-top: 2rem;
}

.char.review-target {
  background: #ffe56b !important;
  color: #6e260e !important;
  outline: 3px solid #b64b2b;
  position: relative;
  z-index: 5;
}

/* ==============================
   SEARCH
============================== */

.search-panel input[type="text"] {
  width: 70%;
  padding: 5px;
}

.search-result {
  padding: 5px;
  border-bottom: 1px solid #ddd;
  cursor: pointer;
}

.search-result:hover {
  background: #f0f0f0;
}

.search-result .snippet {
  font-size: 14px;
  color: #555;
}

/* ==============================
   MODAL
============================== */

.dnntc-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.dnntc-modal-box {
  background: white;
  padding: 20px;
  border-radius: 10px;
  max-width: 400px;
}

/* ==============================
   GUIDE PAGE
============================== */

.doc-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 30px;

  background: #fff;
  border-radius: 8px;

  height: auto;
  overflow: visible;

  font-size: 16px;
  line-height: 1.75;
  color: #1a1a1a;
}

/* Headings */
.doc-page h1 {
  font-size: 34px;
  margin: 0 0 20px 0;
  line-height: 1.2;
}

.doc-page h2 {
  font-size: 26px;
  margin: 28px 0 12px;
}

.doc-page h3 {
  font-size: 20px;
  margin: 24px 0 10px;
}

/* Paragraphs */
.doc-page p {
  margin: 0 0 16px 0;
}

/* Lists */
.doc-page ul,
.doc-page ol {
  margin: 0 0 16px 24px;
  padding: 0;
}

.doc-page li {
  margin-bottom: 6px;
}

/* Blockquotes */
.doc-page blockquote {
  border-left: 4px solid #ddd;
  margin: 16px 0;
  padding: 10px 16px;
  background: #fafafa;
  color: #333;
}

/* Inline emphasis */
.doc-page strong {
  font-weight: 700;
}

.doc-page em {
  font-style: italic;
}

/* Footnotes */
.doc-page sup {
  font-size: 0.8em;
  vertical-align: super;
}

.doc-page a[href^="#fn"] {
  color: #3366cc;
  text-decoration: none;
}

.doc-page a[href^="#fn"]:hover {
  text-decoration: underline;
}

/* Horizontal rule */
.doc-page hr {
  border: none;
  border-top: 1px solid #ddd;
  margin: 24px 0;
}

/* Code (if markdown ever includes it) */
.doc-page code {
  background: #f4f4f4;
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
}

.doc-page pre {
  background: #f4f4f4;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
}

/* ==============================
   SPLASH PAGE
============================== */

.splash-layout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 80px;

  min-height: calc(100vh - 100px);
  padding: 40px 40px 40px 10px;
  box-sizing: border-box;
}

.splash-image {
  flex: 0 0 50%;
}

.splash-image img {
  width: 100%;
  max-width: 700px;
  height: auto;
  display: block;
  border-radius: 8px;
}

.splash-text {
  flex: 0 0 45%;
}

.splash-text h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

.splash-text p {
  font-size: 20px;
  margin-bottom: 30px;
}

.big-button {
  display: inline-block;
  padding: 14px 28px;
  background: #111;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 18px;
}

.big-button:hover {
  background: #333;
}

@media (max-width: 900px) {
  .splash-layout {
    flex-direction: column;
    text-align: center;
  }

  .splash-image,
  .splash-text {
    flex: none;
    width: 100%;
  }
}


.screenshot-placeholder {
  border: 1px solid #ddd;
  padding: 12px;
  margin: 20px 0;
  background: #fafafa;
  border-radius: 6px;

  max-width: 900px;   /* keeps figures readable */
  margin-left: auto;
  margin-right: auto;
}

.screenshot-placeholder img {
  width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
}

.cell {
    display: flex;
    justify-content: center;
    align-items: center;

    box-sizing: border-box;
    white-space: pre;

    border: 1px solid #999;
    text-align: center;
}

.result-grid.no-horizontal .cell {
    border-left: 1px solid #999;
    border-right: 1px solid #999;
    border-top: none;
    border-bottom: none;
}

/* ==============================
   VIEWER CONTROLS
============================== */

.middle-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #f3f3f3;
    color: #111;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.section-toggle:hover,
.section-toggle:focus-visible {
    background: #e8e8e8;
}

.section-toggle-icon {
    min-width: 1em;
    font-size: 1.2em;
    line-height: 1;
    text-align: center;
}

.collapsible-content[hidden] {
    display: none !important;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 15px;
}

.transcription-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.controls-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.selected-char-info {
    font-weight: bold;
}

.header-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
}

/* ==============================
   CONTROL BUTTON ROW
============================== */

.header-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
    width: fit-content;
}

.header-buttons button {
    flex: 0 0 auto;
}


/* ==============================
   VIEWER CONTROLS
============================== */

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}


/* Stack Mode / Horizontal Lines buttons */

.header-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: flex-start;
    align-items: center;
}


/* ==============================
   VOLUME / PAGE CONTROLS
============================== */

.controls-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}


#volume-controls,
#page-controls {
    width: 100%;
}


#volume-controls label,
#page-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ==============================
   ZOOM CONTROLS
============================== */

.zoom-controls {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}


/* ==============================
   TRANSCRIPTION ACTIONS
============================== */

.transcription-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 0 0 12px;
}

.transcription-actions-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 2px 10px 0;
}


.selected-char-info {
    display: block;
}


/* Correction buttons */

.action-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: flex-start;
}


.grid-zoom-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
}

.grid-zoom-wrapper .result-grid {
    width: max-content;
    margin: 0 auto;
}

.grid-zoom-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
}


.result-grid {
    display: grid;
    width: max-content;
    gap: 1px;
}
