/* ============================================================
   m3-table.css — 世系表视图 (一排一代, 横向滚动)
   ============================================================ */

/* 顶栏视图切换 */
.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 4px;
  margin-right: 8px;
  border-radius: 20px;
  background: var(--md-surface-container);
  border: 1px solid var(--md-outline-variant);
}
.view-switch__btn {
  position: relative;
  overflow: hidden;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--md-on-surface-variant);
  font-family: inherit;
  font-size: var(--type-label-large);
  cursor: pointer;
  transition: background-color 200ms var(--ease-entrance), color 200ms var(--ease-entrance),
              var(--morph);
}
.view-switch__btn:hover { background: var(--md-state-hover); color: var(--md-on-surface); }
.view-switch__btn[aria-selected="true"] {
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 500;
}
.view-switch__btn:active { border-radius: var(--shape-xs); }

/* 表格区 */
.table-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--md-surface);
}
.table-view[hidden] { display: none; }

.table-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.table-inner {
  min-width: max-content;
  padding-bottom: 40px;
}

/* 一代一行 */
.gt-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(73, 69, 79, 0.45);
}
.gt-row:last-child { border-bottom: 0; }
.gt-row:nth-child(odd) { background: rgba(230, 224, 233, 0.015); }

/* 左侧固定「第 N 世」 */
.gt-label {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: none;
  width: 116px;
  padding: 10px 14px;
  background: var(--md-surface-container-low);
  border-right: 1px solid var(--md-outline-variant);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}
.gt-label__shi {
  font-size: var(--type-body-medium);
  font-weight: 500;
  color: var(--md-on-surface);
  letter-spacing: .02em;
}
.gt-label__count {
  font-size: var(--type-body-small);
  color: var(--md-on-surface-variant);
}
.gt-label__bei {
  font-size: var(--type-body-small);
  color: var(--md-primary);
}

/* 该世的人 */
.gt-cells {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 14px;
}

.gt-cell {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 92px;
  padding: 7px 8px;
  border: 1px solid var(--md-outline-variant);
  border-radius: 10px;
  background: var(--md-surface-container-low);
  color: var(--md-on-surface);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 160ms var(--ease-entrance), border-color 160ms var(--ease-entrance),
              transform 160ms var(--ease-entrance), opacity 160ms var(--ease-entrance), var(--morph);
}
.gt-cell:hover { background: var(--md-surface-container-high); border-color: var(--md-outline); transform: translateY(-1px); }
.gt-cell:active { border-radius: var(--shape-xs); transform: translateY(0); }
.gt-cell__name { font-size: 14px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-cell__meta { font-size: 11px; color: var(--md-on-surface-variant); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gt-cell.is-focus { border: 2px solid var(--md-primary); background: var(--md-surface-container-high); }
.gt-cell.is-dim { opacity: 0.28; }
.gt-cell.is-hit { border-color: var(--md-primary); background: rgba(208, 188, 255, 0.1); }
.gt-cell.is-bridge {
  border-style: dashed;
  background: transparent;
  color: var(--md-on-surface-variant);
}
.gt-cell.is-bridge .gt-cell__name { font-size: 12px; font-weight: 400; }

.gt-empty {
  padding: 40px 20px;
  color: var(--md-on-surface-variant);
  font-size: var(--type-body-medium);
}
