:root {
  --bg: #ffffff;
  --ink: #203040;
  --line: #a6b2bf;
  --major: #2d3f51;
  --pink: #ffd6e6;
  --blue: #d7efff;
  --gray: #ececec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.banner-area {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  padding: 10px 12px 8px;
  text-align: center;
}

.banner-main {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.banner-sub {
  margin-top: 3px;
  font-size: 11px;
  color: #586978;
  line-height: 1.2;
}

.banner-rotator {
  width: min(100%, 980px);
  margin: 0 auto;
}

.banner-link {
  display: block;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.banner-picture {
  display: block;
  width: 100%;
}

.banner-image {
  display: block;
  width: 100%;
  height: clamp(56px, 8vw, 90px);
  object-fit: cover;
  opacity: 0.62;
  transition: opacity 260ms ease;
}

.banner-image.is-ready {
  opacity: 1;
}

main {
  overflow-x: hidden;
}

.screen-copyright {
  margin: 14px 0 18px;
  text-align: center;
  font-size: 10px;
  color: #6a7683;
}

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #ffffffdd;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.actions {
  display: flex;
  gap: 8px;
}

.print-meta {
  display: none;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}

.boards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}

.site-access-notice {
  margin: 8px auto;
  max-width: 720px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 18px;
  background: #fff;
  text-align: center;
}

.site-access-notice h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #1f3550;
}

.site-access-notice p {
  margin: 0;
  font-size: 14px;
  color: #355069;
}

.board {
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 6px;
}

.board-row {
  --side-width: 28px;
  --row-gap: 8px;
  --betcho-gap: 10px;
  --betcho-right-space: 10px;
  --board-pages: 16;
  --inner-width: calc(100% - var(--side-width) - (2 * var(--row-gap)));
  --one-page-width: calc(
    (var(--inner-width) - var(--betcho-gap) - var(--betcho-right-space)) / (var(--board-pages) + 1)
  );
  --betcho-reserve: calc(var(--one-page-width) + var(--betcho-gap) + var(--betcho-right-space));
  position: relative;
  display: grid;
  grid-template-columns: var(--side-width) minmax(0, 1fr) var(--betcho-reserve);
  column-gap: var(--row-gap);
  align-items: flex-start;
  overflow: hidden;
}

.board-row .board-side {
  grid-column: 1;
}

.board-row .page-track {
  grid-column: 2;
  width: 100%;
  padding-left: var(--betcho-gap);
  box-sizing: border-box;
}

.board-row.right-opening {
  grid-template-columns: var(--betcho-reserve) minmax(0, 1fr) var(--side-width);
}

.board-row.right-opening .board-side {
  grid-column: 3;
}

.board-row.right-opening .page-track {
  grid-column: 2;
  padding-left: 0;
  padding-right: var(--betcho-gap);
}

.betcho-list {
  grid-column: 3;
  width: 100%;
  padding-left: var(--betcho-gap);
  padding-right: var(--betcho-right-space);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
  pointer-events: auto;
}

.board-row.right-opening .betcho-list {
  grid-column: 1;
  padding-left: var(--betcho-right-space);
  padding-right: var(--betcho-gap);
}

.betcho-item {
  min-height: 56px;
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: auto;
}

.betcho-name {
  font-size: 10px;
  line-height: 1.3;
  font-weight: 600;
  word-break: break-all;
}

.betcho-advance {
  margin-top: 2px;
  font-size: 9px;
  color: #455a6f;
}

.board-side {
  width: 28px;
  flex: 0 0 28px;
  display: flex;
  flex-direction: column;
}

.board-no,
.board-format {
  border: 1px solid var(--line);
  text-align: center;
  font-size: 10px;
  line-height: 1.2;
  padding: 3px 0;
}

.board-format {
  margin-top: 4px;
}

.board-hold .hold-row-plain {
  border-right: 0 !important;
}

.board-hold-gap {
  padding: 6px;
}

.board-hold-gap .hold-gap-row {
  min-height: 74px;
}

.page-track {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 0;
  width: 100%;
}

.page-slot {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-slot.is-blank .page-cell {
  border: 0;
  background: transparent;
}

.page-slot.is-blank .page-number {
  color: transparent;
}

.page-cell {
  min-height: 56px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  padding: 0;
  overflow: hidden;
  user-select: none;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.page-number {
  min-height: 14px;
  font-size: 10px;
  color: #28333f;
  text-align: center;
  padding-top: 1px;
}

.cell-row {
  min-height: 0;
  padding: 1px 3px;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.row-large {
  flex: 0 0 22px;
  background: #fff;
  border-bottom: 1px solid #9eabb7;
}

.row-middle {
  flex: 0 0 16px;
  background: #fff;
}

.row-small {
  flex: 0 0 16px;
  background: #fff;
}

.segment {
  display: block;
  max-width: 100%;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0;
  margin: 0;
  line-height: 1.25;
  background: transparent;
  border-radius: 0;
}

.board-row.right-opening .segment {
  text-align: right;
}

.seg-large {
  font-weight: 500;
}

.seg-middle {
  font-weight: 400;
}

.seg-small {
  font-size: 9px;
}

.left-thick {
  border-left: 2px solid #99a8b3;
}

.sep-none {
  border-right: 0 !important;
}

.sep-solid {
  border-right: 1px solid #9eabb7;
}

.sep-dotted {
  border-right: 2px dotted #9eabb7;
}

.sep-thick {
  border-right: 2px solid #9eabb7;
}

.is-over {
  background: var(--pink);
}

.is-under {
  background: var(--blue);
}

.band-over {
  background: var(--pink);
}

.band-under {
  background: var(--blue);
}

.row-middle.band-over {
  background: var(--pink);
}

.row-small.band-over {
  background: #fff;
}

.is-anon {
  background: transparent;
  color: inherit;
}

.tooltip {
  position: fixed;
  z-index: 50;
  max-width: 320px;
  font-size: 12px;
  background: #2f3e4dbf;
  color: #fff;
  padding: 8px;
  border-radius: 6px;
  line-height: 1.4;
}

.hidden {
  display: none;
}

dialog {
  width: min(1000px, 94vw);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

dialog::backdrop {
  background: #0f1f3040;
}

.help-body {
  font-size: 13px;
  line-height: 1.45;
}

.help-body h4 {
  margin: 10px 0 4px;
  font-size: 13px;
}

.help-body p {
  margin: 0 0 6px;
}

#editorDialog .editor-text-wrap {
  position: relative;
}

#editorText {
  width: 100%;
  height: min(70vh, 700px);
  font-family: ui-monospace, "Cascadia Code", monospace;
}

.editor-assist {
  margin-top: 6px;
}

.editor-help {
  font-size: 11px;
  color: #5c6976;
  line-height: 1.3;
}

.editor-help code {
  font-family: ui-monospace, "Cascadia Code", monospace;
}

.editor-candidate {
  position: absolute;
  left: 0;
  top: 0;
  color: #0d5cff;
  font-size: 14px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  white-space: pre;
  pointer-events: none;
  min-height: 0;
  z-index: 2;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.dialog-copyright {
  margin-top: 12px;
  text-align: center;
  font-size: 10px;
  color: #6a7683;
}

.article-list .article-tree-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.article-list .article-tree-table th,
.article-list .article-tree-table td {
  border: 1px solid var(--line);
  padding: 4px;
  vertical-align: top;
}

.article-list .article-tree-table th {
  background: #f5f7fa;
  font-weight: 600;
  text-align: left;
}

.article-list .article-tree-table .tree-cell {
  min-height: 22px;
}

.article-list .article-tree-table .meta-cell {
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.article-list .article-tree-table .meta-deadline {
  white-space: nowrap;
  word-break: keep-all;
}

.article-list .article-tree-table .meta-status {
  white-space: nowrap;
}

.article-list .article-tree-table .meta-desk,
.article-list .article-tree-table .meta-editor,
.article-list .article-tree-table .meta-writer {
  white-space: nowrap;
  word-break: keep-all;
}

.article-list .article-tree-table .meta-memo {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.article-list-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.article-list-meta {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #2a3c4d;
}

.article-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.article-list .article-tree-table .cell-large {
  font-weight: 600;
}

.article-list .article-tree-table .cell-middle {
  font-weight: 500;
}

.article-list .article-tree-table .cell-small {
  font-weight: 400;
}

.article-list .article-tree-table .cell-betcho {
  background: #f7fbff;
  color: #264260;
}

.article-list .article-tree-table .cell-hold {
  background: #fff7dd;
  color: #4a3e1e;
}

.article-list .article-tree-table .cell-addon {
  background: #f1f8ff;
  color: #214463;
}

.article-list .article-tree-table .hold-separator-cell {
  border: 0;
  height: 22px;
  background: transparent;
  padding: 0;
}

.article-list .article-tree-table .tree-guide {
  background: #fff;
}

.article-list .article-tree-table .no-top {
  border-top: 0 !important;
  border-top-style: hidden !important;
}

.article-list-empty {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: #526476;
}

.print-article-sheet {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  html,
  body {
    width: 210mm;
    background: #fff;
  }

  .topbar,
  .banner-area,
  #editorDialog,
  #articleDialog,
  #helpDialog,
  #articleDialog .dialog-actions,
  .screen-copyright,
  .dialog-copyright {
    display: none;
  }

  .boards {
    gap: 3mm;
    padding: 0;
  }

  .print-meta {
    display: block;
    margin: 0 0 3mm;
    padding-bottom: 1.5mm;
    border-bottom: 0.3mm solid #8f9eaa;
    font-size: 10.5pt;
    font-weight: 600;
    line-height: 1.3;
    color: #1f2f40;
  }

  .board {
    width: 100%;
    margin: 0;
    padding: 2mm;
    border: 0;
    border-radius: 0;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .page-cell,
  .row-large,
  .row-middle,
  .row-small,
  .segment,
  .betcho-item {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.print-article-list > * {
    display: none !important;
  }

  body.print-article-list #printArticleSheet {
    display: block !important;
    width: 100%;
    margin: 0;
    padding: 0;
    color: #111;
  }

  body.print-article-list #printArticleSheet h1 {
    margin: 0 0 2.5mm;
    font-size: 13pt;
    font-weight: 700;
  }

  body.print-article-list #printArticleSheet .article-list-meta {
    margin: 0 0 2.5mm;
    font-size: 9pt;
    font-weight: 600;
    color: #111;
  }

  body.print-article-list #printArticleSheet .article-list {
    max-height: none !important;
    overflow: visible !important;
  }

  body.print-article-list #printArticleSheet .article-list-toolbar {
    display: none !important;
  }

  body.print-article-list #printArticleSheet .article-tree-table {
    font-size: 8.5pt;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: #fff;
  }

  body.print-article-list #printArticleSheet .article-tree-table thead {
    display: table-header-group;
  }

  body.print-article-list #printArticleSheet .article-tree-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.print-article-list #printArticleSheet .article-tree-table th,
  body.print-article-list #printArticleSheet .article-tree-table td {
    padding: 1.4mm 1.2mm;
    border: 0.2mm solid #8a97a5;
    background: #fff !important;
    color: #111;
    vertical-align: top;
  }

  body.print-article-list #printArticleSheet .article-tree-table th {
    font-weight: 700;
  }

  body.print-article-list #printArticleSheet .article-tree-table .hold-separator-cell {
    border: 0 !important;
    padding: 0 !important;
    height: 2.2mm;
    background: transparent !important;
  }

  body.print-article-list #printArticleSheet .article-tree-table .meta-deadline,
  body.print-article-list #printArticleSheet .article-tree-table .meta-status,
  body.print-article-list #printArticleSheet .article-tree-table .meta-desk,
  body.print-article-list #printArticleSheet .article-tree-table .meta-editor,
  body.print-article-list #printArticleSheet .article-tree-table .meta-writer {
    white-space: nowrap;
  }

  body.print-article-list #printArticleSheet .article-tree-table .meta-memo {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.print-article-list #printArticleSheet .copyright {
    margin-top: 4mm;
    text-align: center;
    font-size: 8pt;
    color: #666;
  }
}
